Skip to content

Commit 32d9e13

Browse files
committed
Implement function JIT, fix unset result on undefined var exception
1 parent e52a615 commit 32d9e13

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,6 +2594,23 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
25942594
call_level--;
25952595
}
25962596
break;
2597+
case ZEND_FRAMELESS_ICALL_0:
2598+
jit_frameless_icall0(jit, opline);
2599+
goto done;
2600+
case ZEND_FRAMELESS_ICALL_1:
2601+
op1_info = OP1_INFO();
2602+
jit_frameless_icall1(jit, opline, op1_info);
2603+
goto done;
2604+
case ZEND_FRAMELESS_ICALL_2:
2605+
op1_info = OP1_INFO();
2606+
op2_info = OP2_INFO();
2607+
jit_frameless_icall2(jit, opline, op1_info, op2_info);
2608+
goto done;
2609+
case ZEND_FRAMELESS_ICALL_3:
2610+
op1_info = OP1_INFO();
2611+
op2_info = OP2_INFO();
2612+
jit_frameless_icall3(jit, opline, op1_info, op2_info, OP1_DATA_INFO());
2613+
goto done;
25972614
default:
25982615
if (!zend_jit_handler(&ctx, opline,
25992616
zend_may_throw(opline, ssa_op, op_array, ssa))) {

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16665,9 +16665,9 @@ static void jit_frameless_icall1(zend_jit_ctx *jit, const zend_op *opline, uint3
1666516665
zend_jit_addr op1_addr = OP1_ADDR();
1666616666
ir_ref res_ref = jit_ZVAL_ADDR(jit, res_addr);
1666716667
ir_ref op1_ref = jit_ZVAL_ADDR(jit, op1_addr);
16668+
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1666816669
zend_jit_zval_check_undef(jit, op1_ref, opline->op1.var, opline, 1);
1666916670
op1_ref = jit_ZVAL_DEREF_ref(jit, op1_ref);
16670-
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1667116671
ir_CALL_2(IR_VOID, ir_CONST_ADDR((size_t)function), res_ref, op1_ref);
1667216672
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, NULL);
1667316673
zend_jit_check_exception(jit);
@@ -16684,11 +16684,11 @@ static void jit_frameless_icall2(zend_jit_ctx *jit, const zend_op *opline, uint3
1668416684
ir_ref res_ref = jit_ZVAL_ADDR(jit, res_addr);
1668516685
ir_ref op1_ref = jit_ZVAL_ADDR(jit, op1_addr);
1668616686
ir_ref op2_ref = jit_ZVAL_ADDR(jit, op2_addr);
16687+
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1668716688
zend_jit_zval_check_undef(jit, op1_ref, opline->op1.var, opline, 1);
1668816689
zend_jit_zval_check_undef(jit, op2_ref, opline->op2.var, opline, 1);
1668916690
op1_ref = jit_ZVAL_DEREF_ref(jit, op1_ref);
1669016691
op2_ref = jit_ZVAL_DEREF_ref(jit, op2_ref);
16691-
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1669216692
ir_CALL_3(IR_VOID, ir_CONST_ADDR((size_t)function), res_ref, op1_ref, op2_ref);
1669316693
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, NULL);
1669416694
jit_FREE_OP(jit, opline->op2_type, opline->op2, op2_info, NULL);
@@ -16708,13 +16708,13 @@ static void jit_frameless_icall3(zend_jit_ctx *jit, const zend_op *opline, uint3
1670816708
ir_ref op1_ref = jit_ZVAL_ADDR(jit, op1_addr);
1670916709
ir_ref op2_ref = jit_ZVAL_ADDR(jit, op2_addr);
1671016710
ir_ref op3_ref = jit_ZVAL_ADDR(jit, op3_addr);
16711+
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1671116712
zend_jit_zval_check_undef(jit, op1_ref, opline->op1.var, opline, 1);
1671216713
zend_jit_zval_check_undef(jit, op2_ref, opline->op2.var, opline, 1);
1671316714
zend_jit_zval_check_undef(jit, op3_ref, (opline+1)->op1.var, opline, 1);
1671416715
op1_ref = jit_ZVAL_DEREF_ref(jit, op1_ref);
1671516716
op2_ref = jit_ZVAL_DEREF_ref(jit, op2_ref);
1671616717
op3_ref = jit_ZVAL_DEREF_ref(jit, op3_ref);
16717-
jit_set_Z_TYPE_INFO(jit, res_addr, IS_NULL);
1671816718
ir_CALL_4(IR_VOID, ir_CONST_ADDR((size_t)function), res_ref, op1_ref, op2_ref, op3_ref);
1671916719
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, NULL);
1672016720
jit_FREE_OP(jit, opline->op2_type, opline->op2, op2_info, NULL);

0 commit comments

Comments
 (0)