Skip to content

Commit 71b16ee

Browse files
author
test@test.test
committed
Fixup jit
1 parent 14bd59a commit 71b16ee

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

Zend/zend_execute.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,9 +1548,8 @@ static void zend_frameless_observed_call_push(zend_execute_data *call, uint8_t a
15481548
}
15491549
}
15501550

1551-
ZEND_API void zend_frameless_observed_call(zend_execute_data *execute_data)
1551+
ZEND_API void zend_frameless_observed_call(EXECUTE_DATA_D OPLINE_DC)
15521552
{
1553-
const zend_op *opline = EX(opline);
15541553
uint8_t num_args = ZEND_FLF_NUM_ARGS(opline->opcode);
15551554
zend_function *fbc = ZEND_FLF_FUNC(opline);
15561555

Zend/zend_execute.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,6 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
430430
ZEND_API ZEND_ATTRIBUTE_DEPRECATED HashTable *zend_unfinished_execution_gc(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer);
431431
ZEND_API HashTable *zend_unfinished_execution_gc_ex(zend_execute_data *execute_data, zend_execute_data *call, zend_get_gc_buffer *gc_buffer, bool suspended_by_yield);
432432

433-
ZEND_API void zend_frameless_observed_call(zend_execute_data *execute_data);
434-
435433
zval * ZEND_FASTCALL zend_handle_named_arg(
436434
zend_execute_data **call_ptr, zend_string *arg_name,
437435
uint32_t *arg_num_ptr, void **cache_slot);

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9603,7 +9603,7 @@ ZEND_VM_HELPER(zend_frameless_observed_call, ANY, ANY)
96039603
{
96049604
USE_OPLINE
96059605

9606-
zend_frameless_observed_call(execute_data);
9606+
zend_frameless_observed_call(EXECUTE_DATA_C OPLINE_CC);
96079607

96089608
if (UNEXPECTED(EG(exception) != NULL)) {
96099609
zend_rethrow_exception(execute_data);

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,8 +3279,3 @@ static zend_string* ZEND_FASTCALL zend_jit_rope_end(zend_string **rope, uint32_t
32793279
return ret;
32803280
}
32813281

3282-
static void ZEND_FASTCALL zend_jit_observed_frameless_helper(zend_execute_data *execute_data)
3283-
{
3284-
zend_frameless_observed_call(execute_data);
3285-
}
3286-

ext/opcache/jit/zend_jit_ir.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,7 +3069,6 @@ static void zend_jit_setup_disasm(void)
30693069
REGISTER_HELPER(zend_jit_pre_dec_obj_helper);
30703070
REGISTER_HELPER(zend_jit_post_dec_obj_helper);
30713071
REGISTER_HELPER(zend_jit_rope_end);
3072-
REGISTER_HELPER(zend_jit_observed_frameless_helper);
30733072

30743073
#ifndef ZTS
30753074
REGISTER_DATA(EG(current_execute_data));
@@ -17051,6 +17050,7 @@ static bool zend_jit_may_be_in_reg(const zend_op_array *op_array, zend_ssa *ssa,
1705117050
return 1;
1705217051
}
1705317052

17053+
void zend_frameless_observed_call(void); // we just care about the symbol to use it here, IP and FP may need to be passed depending on global regs
1705417054
static ir_ref jit_frameless_observer(zend_jit_ctx *jit, const zend_op *opline) {
1705517055
// JIT: zend_observer_handler_is_unobserved(ZEND_OBSERVER_DATA(fbc))
1705617056
ir_ref observer_handler;
@@ -17059,7 +17059,15 @@ static ir_ref jit_frameless_observer(zend_jit_ctx *jit, const zend_op *opline) {
1705917059
ir_ref if_unobserved = jit_observer_fcall_is_unobserved_start(jit, fbc, &observer_handler, IR_UNUSED, IR_UNUSED).if_unobserved;
1706017060

1706117061
// push call frame
17062-
ir_CALL_1(IR_ADDR, ir_CONST_FC_FUNC(zend_jit_observed_frameless_helper), jit_FP(jit));
17062+
if (GCC_GLOBAL_REGS) {
17063+
// FP register will point to the right place, but zend_frameless_observed_call needs IP to be also pointing to the precise opline.
17064+
ir_ref old_ip = ir_HARD_COPY_A(ir_RLOAD_A(ZREG_IP));
17065+
ir_RSTORE(ZREG_IP, ir_CONST_ADDR(opline));
17066+
ir_CALL(IR_VOID, ir_CONST_ADDR((size_t)zend_frameless_observed_call));
17067+
ir_RSTORE(ZREG_IP, old_ip); // restore it so that further offset calculations are not wrong
17068+
} else {
17069+
ir_CALL_2(IR_VOID, ir_CONST_ADDR((size_t)zend_frameless_observed_call), jit_FP(jit), ir_CONST_ADDR(opline));
17070+
}
1706317071

1706417072
ir_ref skip = ir_END();
1706517073
ir_IF_TRUE(if_unobserved);

0 commit comments

Comments
 (0)