Skip to content

Commit 7b989c6

Browse files
committed
Cleanup unneeded changes
1 parent 2931e0e commit 7b989c6

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

Zend/zend_execute.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,14 @@ static zend_never_inline void zend_assign_to_object_dim(zend_object *obj, zval *
15401540
}
15411541
}
15421542

1543+
static void frameless_observed_call_copy(zend_execute_data *call, uint32_t arg, zval *zv)
1544+
{
1545+
if (Z_ISUNDEF_P(zv)) {
1546+
ZVAL_NULL(zv);
1547+
}
1548+
ZVAL_COPY_DEREF(ZEND_CALL_VAR_NUM(call, arg), zv);
1549+
}
1550+
15431551
ZEND_API void zend_frameless_observed_call(zend_execute_data *execute_data)
15441552
{
15451553
const zend_op *opline = EX(opline);
@@ -1551,9 +1559,9 @@ ZEND_API void zend_frameless_observed_call(zend_execute_data *execute_data)
15511559
call->prev_execute_data = execute_data;
15521560

15531561
switch (num_args) {
1554-
case 3: ZVAL_COPY_DEREF(ZEND_CALL_VAR_NUM(call, 2), zend_get_zval_ptr(opline+1, (opline+1)->op1_type, &(opline+1)->op1, execute_data)); ZEND_FALLTHROUGH;
1555-
case 2: ZVAL_COPY_DEREF(ZEND_CALL_VAR_NUM(call, 1), zend_get_zval_ptr(opline, opline->op2_type, &opline->op2, execute_data)); ZEND_FALLTHROUGH;
1556-
case 1: ZVAL_COPY_DEREF(ZEND_CALL_VAR_NUM(call, 0), zend_get_zval_ptr(opline, opline->op1_type, &opline->op1, execute_data));
1562+
case 3: frameless_observed_call_copy(call, 2, zend_get_zval_ptr(opline+1, (opline+1)->op1_type, &(opline+1)->op1, execute_data)); ZEND_FALLTHROUGH;
1563+
case 2: frameless_observed_call_copy(call, 1, zend_get_zval_ptr(opline, opline->op2_type, &opline->op2, execute_data)); ZEND_FALLTHROUGH;
1564+
case 1: frameless_observed_call_copy(call, 0, zend_get_zval_ptr(opline, opline->op1_type, &opline->op1, execute_data));
15571565
}
15581566

15591567
EG(current_execute_data) = call;

Zend/zend_observer.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ extern ZEND_API bool zend_observer_errors_observed;
3333
extern ZEND_API bool zend_observer_function_declared_observed;
3434
extern ZEND_API bool zend_observer_class_linked_observed;
3535

36-
typedef void (*zend_observer_fcall_begin_handler)(zend_execute_data *execute_data);
37-
typedef void (*zend_observer_fcall_end_handler)(zend_execute_data *execute_data, zval *retval);
38-
39-
typedef struct _zend_observer_fcall_handlers {
40-
zend_observer_fcall_begin_handler begin;
41-
zend_observer_fcall_end_handler end;
42-
} zend_observer_fcall_handlers;
43-
44-
4536
#define ZEND_OBSERVER_HANDLE(function) (ZEND_USER_CODE((function)->type) \
4637
? zend_observer_fcall_op_array_extension : zend_observer_fcall_internal_function_extension)
4738

@@ -67,6 +58,14 @@ typedef struct _zend_observer_fcall_handlers {
6758
} \
6859
} while (0)
6960

61+
typedef void (*zend_observer_fcall_begin_handler)(zend_execute_data *execute_data);
62+
typedef void (*zend_observer_fcall_end_handler)(zend_execute_data *execute_data, zval *retval);
63+
64+
typedef struct _zend_observer_fcall_handlers {
65+
zend_observer_fcall_begin_handler begin;
66+
zend_observer_fcall_end_handler end;
67+
} zend_observer_fcall_handlers;
68+
7069
/* If the fn should not be observed then return {NULL, NULL} */
7170
typedef zend_observer_fcall_handlers (*zend_observer_fcall_init)(zend_execute_data *execute_data);
7271

Zend/zend_vm_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9627,7 +9627,7 @@ ZEND_VM_HANDLER(205, ZEND_FRAMELESS_ICALL_1, ANY, UNUSED, SPEC(OBSERVER))
96279627
zval *result = EX_VAR(opline->result.var);
96289628
ZVAL_NULL(result);
96299629
zval *arg1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
9630-
if (UNEXPECTED(EG(exception) != NULL)) {
9630+
if (EG(exception)) {
96319631
FREE_OP1();
96329632
HANDLE_EXCEPTION();
96339633
}
@@ -9654,7 +9654,7 @@ ZEND_VM_HANDLER(206, ZEND_FRAMELESS_ICALL_2, ANY, ANY, SPEC(OBSERVER))
96549654
ZVAL_NULL(result);
96559655
zval *arg1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
96569656
zval *arg2 = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
9657-
if (UNEXPECTED(EG(exception) != NULL)) {
9657+
if (EG(exception)) {
96589658
FREE_OP1();
96599659
FREE_OP2();
96609660
HANDLE_EXCEPTION();
@@ -9689,7 +9689,7 @@ ZEND_VM_HANDLER(207, ZEND_FRAMELESS_ICALL_3, ANY, ANY, SPEC(OBSERVER))
96899689
zval *arg1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
96909690
zval *arg2 = GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R);
96919691
zval *arg3 = GET_OP_DATA_ZVAL_PTR_DEREF(BP_VAR_R);
9692-
if (UNEXPECTED(EG(exception) != NULL)) {
9692+
if (EG(exception)) {
96939693
FREE_OP1();
96949694
FREE_OP2();
96959695
FREE_OP_DATA();

Zend/zend_vm_execute.h

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/opcache/jit/zend_jit_ir.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8274,11 +8274,10 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
82748274
ir_ref used_stack_ref = IR_UNUSED;
82758275
bool stack_check = 1;
82768276
ir_ref rx, ref, top, if_enough_stack, cold_path = IR_UNUSED;
8277-
uint32_t num_args = ZEND_OP_IS_FRAMELESS_ICALL(opline->opcode) ? ZEND_FLF_NUM_ARGS(opline->opcode) : opline->extended_value;
82788277

82798278
ZEND_ASSERT(func_ref != IR_NULL);
82808279
if (func) {
8281-
used_stack = zend_vm_calc_used_stack(num_args, func);
8280+
used_stack = zend_vm_calc_used_stack(opline->extended_value, func);
82828281
if ((int)used_stack <= checked_stack) {
82838282
stack_check = 0;
82848283
}
@@ -8361,7 +8360,7 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
83618360
#ifdef _WIN32
83628361
if (0) {
83638362
#else
8364-
if ((opline->opcode == ZEND_INIT_FCALL || ZEND_OP_IS_FRAMELESS_ICALL(opline->opcode)) && func && func->type == ZEND_INTERNAL_FUNCTION) {
8363+
if (opline->opcode == ZEND_INIT_FCALL && func && func->type == ZEND_INTERNAL_FUNCTION) {
83658364
#endif
83668365
jit_SET_EX_OPLINE(jit, opline);
83678366
ref = ir_CALL_1(IR_ADDR, ir_CONST_FC_FUNC(zend_jit_int_extend_stack_helper), used_stack_ref);
@@ -8514,7 +8513,7 @@ static int zend_jit_push_call_frame(zend_jit_ctx *jit, const zend_op *opline, co
85148513
}
85158514

85168515
// JIT: ZEND_CALL_NUM_ARGS(call) = num_args;
8517-
ir_STORE(jit_CALL(rx, This.u2.num_args), ir_CONST_U32(num_args));
8516+
ir_STORE(jit_CALL(rx, This.u2.num_args), ir_CONST_U32(opline->extended_value));
85188517

85198518
return 1;
85208519
}
@@ -17179,7 +17178,6 @@ static void jit_frameless_icall2(zend_jit_ctx *jit, const zend_op *opline, uint3
1717917178

1718017179
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, NULL);
1718117180
/* Set OP1 to UNDEF in case FREE_OP2() throws. */
17182-
// TODO: I believe this is only necessary when jit_ir_needs_dtor is true for either op
1718317181
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) != 0 && (opline->op2_type & (IS_VAR|IS_TMP_VAR)) != 0) {
1718417182
jit_set_Z_TYPE_INFO(jit, op1_addr, IS_UNDEF);
1718517183
}

0 commit comments

Comments
 (0)