mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Tracing JIT: Fixed bug in register allocator.
This commit is contained in:
@@ -4042,8 +4042,17 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
|
||||
|
||||
if (ival) {
|
||||
if (ival->flags & ZREG_LOAD) {
|
||||
uint32_t info = ssa->var_info[phi->ssa_var].type;
|
||||
ZEND_ASSERT(ival->reg != ZREG_NONE);
|
||||
|
||||
if (info & MAY_BE_GUARD) {
|
||||
if (!zend_jit_type_guard(&dasm_state, opline, phi->var, concrete_type(info))) {
|
||||
goto jit_failure;
|
||||
}
|
||||
info &= ~MAY_BE_GUARD;
|
||||
ssa->var_info[phi->ssa_var].type = info;
|
||||
SET_STACK_TYPE(stack, i, concrete_type(info), 1);
|
||||
}
|
||||
SET_STACK_REG_EX(stack, phi->var, ival->reg, ZREG_LOAD);
|
||||
if (!zend_jit_load_var(&dasm_state, ssa->var_info[phi->ssa_var].type, ssa->vars[phi->ssa_var].var, ival->reg)) {
|
||||
goto jit_failure;
|
||||
|
||||
40
ext/opcache/tests/jit/reg_alloc_004.phpt
Normal file
40
ext/opcache/tests/jit/reg_alloc_004.phpt
Normal file
@@ -0,0 +1,40 @@
|
||||
--TEST--
|
||||
Register Alloction 004: Check guard before register load
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
opcache.protect_memory=1
|
||||
opcache.jit=tracing
|
||||
opcache.jit_hot_func=1
|
||||
--EXTENSIONS--
|
||||
opcache
|
||||
--FILE--
|
||||
<?php
|
||||
function createTree($depth) {
|
||||
if (!$depth) {
|
||||
return;
|
||||
}
|
||||
$depth--;
|
||||
[createTree($d), createTree($depth)]();
|
||||
}
|
||||
createTree(4);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Undefined variable $d in %sreg_alloc_004.php on line 7
|
||||
|
||||
Warning: Undefined variable $d in %sreg_alloc_004.php on line 7
|
||||
|
||||
Warning: Undefined variable $d in %sreg_alloc_004.php on line 7
|
||||
|
||||
Warning: Undefined variable $d in %sreg_alloc_004.php on line 7
|
||||
|
||||
Fatal error: Uncaught Error: First array member is not a valid class name or object in %sreg_alloc_004.php:7
|
||||
Stack trace:
|
||||
#0 %sreg_alloc_004.php(7): createTree(0)
|
||||
#1 %sreg_alloc_004.php(7): createTree(1)
|
||||
#2 %sreg_alloc_004.php(7): createTree(2)
|
||||
#3 %sreg_alloc_004.php(9): createTree(3)
|
||||
#4 {main}
|
||||
thrown in %sreg_alloc_004.php on line 7
|
||||
Reference in New Issue
Block a user