Skip to content

Commit 20cbb23

Browse files
committed
Checj type guards before loading values into CPU registers
1 parent 30cf0a0 commit 20cbb23

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3379,6 +3379,18 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
33793379
if (ra[i]
33803380
&& (ra[i]->flags & ZREG_LOAD) != 0
33813381
&& ra[i]->reg != stack[i].reg) {
3382+
3383+
if ((ssa->var_info[i].type & MAY_BE_GUARD) != 0) {
3384+
uint8_t op_type;
3385+
3386+
ssa->var_info[i].type &= ~MAY_BE_GUARD;
3387+
op_type = concrete_type(ssa->var_info[i].type);
3388+
if (!zend_jit_type_guard(&dasm_state, opline, i, op_type)) {
3389+
goto jit_failure;
3390+
}
3391+
SET_STACK_TYPE(stack, i, op_type, 1);
3392+
}
3393+
33823394
SET_STACK_REG_EX(stack, i, ra[i]->reg, ZREG_LOAD);
33833395
if (!zend_jit_load_var(&dasm_state, ssa->var_info[i].type, i, ra[i]->reg)) {
33843396
goto jit_failure;

0 commit comments

Comments
 (0)