Skip to content

Commit 313ebe8

Browse files
Merge pull request #11 from henderkes/reify
Reify
2 parents 0db2304 + 9135e2f commit 313ebe8

20 files changed

Lines changed: 2050 additions & 385 deletions

Zend/Optimizer/compact_literals.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,14 +696,14 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
696696
break;
697697
case ZEND_VERIFY_GENERIC_ARGUMENTS:
698698
case ZEND_INSTALL_GENERIC_ARGS:
699-
/* When this site has a turbofish (args_id in extended_value),
700-
* the compiler allocated a 2-slot inline cache for the
701-
* (zend_type_arg_table*, cache key) pair — re-allocate it
702-
* here so the offset stays in sync with compact_literals'
703-
* fresh cache_size. */
704-
if (opline->extended_value != 0) {
699+
/* When this site has a turbofish (args_id in extended_value)
700+
* or is a call (op1_type == IS_UNUSED, which caches its table
701+
* regardless), the compiler allocated a 5-slot inline cache —
702+
* re-allocate it here so the offset stays in sync with
703+
* compact_literals' fresh cache_size. */
704+
if (opline->extended_value != 0 || opline->op1_type == IS_UNUSED) {
705705
opline->result.num = cache_size;
706-
cache_size += 2 * sizeof(void *);
706+
cache_size += 5 * sizeof(void *);
707707
}
708708
break;
709709
case ZEND_CATCH:

Zend/tests/generics/reification/inference_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ try {
1818
echo "TypeError: ", $e->getMessage(), "\n";
1919
}
2020
?>
21-
--EXPECT--
21+
--EXPECTF--
2222
Foo
2323
Bar
24-
TypeError: kind(): Argument #1 ($x) must be of type Foo, Bar given
24+
TypeError: kind(): Argument #1 ($x) must be of type Foo, Bar given, called in %s on line %d

Zend/tests/generics/reification/variadic_t_reified.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ try {
6767
?>
6868
--EXPECTF--
6969
int(6)
70-
1: sum(): Argument #2 ($xs) must be of type int, string given
71-
2: sum(): Argument #3 ($xs) must be of type int, string given
70+
1: sum(): Argument #2 must be of type int, string given, called in %s on line %d
71+
2: sum(): Argument #3 must be of type int, string given, called in %s on line %d
7272
string(6) ":: 123"
73-
3: concat(): Argument #3 ($xs) must be of type int, array given
73+
3: concat(): Argument #3 must be of type int, array given, called in %s on line %d
7474
int(3)
75-
4: herd(): Argument #2 ($xs) must be of type Dog, Cat given
75+
4: herd(): Argument #2 must be of type Dog, Cat given, called in %s on line %d

0 commit comments

Comments
 (0)