Stop recording of trace when encountering hook

Fixes GH-15178
This commit is contained in:
Ilija Tovilo 2024-08-26 17:26:18 +02:00
parent b839c5f1af
commit 606eb849bb
No known key found for this signature in database
GPG key ID: 5050C66BFCD1015A
3 changed files with 17 additions and 0 deletions

1
NEWS
View file

@ -37,6 +37,7 @@ PHP NEWS
- Opcache: - Opcache:
. Fixed bug GH-15490 (Building of callgraph modifies preloaded symbols). . Fixed bug GH-15490 (Building of callgraph modifies preloaded symbols).
(ilutov) (ilutov)
. Fixed bug GH-15178 (Assertion in tracing JIT on hooks). (ilutov)
- PDO_MYSQL: - PDO_MYSQL:
. mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT. (Appla) . mysqlnd: support ER_CLIENT_INTERACTION_TIMEOUT. (Appla)

View file

@ -265,6 +265,7 @@ zend_constant* ZEND_FASTCALL zend_jit_check_constant(const zval *key);
_(INNER_LOOP, "inner loop") /* trace it */ \ _(INNER_LOOP, "inner loop") /* trace it */ \
_(COMPILED_LOOP, "compiled loop") \ _(COMPILED_LOOP, "compiled loop") \
_(TRAMPOLINE, "trampoline call") \ _(TRAMPOLINE, "trampoline call") \
_(PROP_HOOK_CALL, "property hook call") \
_(BAD_FUNC, "bad function call") \ _(BAD_FUNC, "bad function call") \
_(COMPILER_ERROR, "JIT compilation error") \ _(COMPILER_ERROR, "JIT compilation error") \
/* no recoverable error (blacklist immediately) */ \ /* no recoverable error (blacklist immediately) */ \

View file

@ -503,6 +503,11 @@ static int zend_jit_trace_record_fake_init_call_ex(zend_execute_data *call, zend
/* TODO: Can we continue recording ??? */ /* TODO: Can we continue recording ??? */
return -1; return -1;
} }
/* Function is a property hook. */
if (func->common.prop_info) {
/* TODO: Can we continue recording ??? */
return -1;
}
if (func->type == ZEND_INTERNAL_FUNCTION if (func->type == ZEND_INTERNAL_FUNCTION
&& (func->op_array.fn_flags & (ZEND_ACC_CLOSURE|ZEND_ACC_FAKE_CLOSURE))) { && (func->op_array.fn_flags & (ZEND_ACC_CLOSURE|ZEND_ACC_FAKE_CLOSURE))) {
return -1; return -1;
@ -966,6 +971,12 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
break; break;
} }
if (EX(func)->op_array.prop_info) {
/* TODO: Can we continue recording ??? */
stop = ZEND_JIT_TRACE_STOP_PROP_HOOK_CALL;
break;
}
TRACE_RECORD(ZEND_JIT_TRACE_ENTER, TRACE_RECORD(ZEND_JIT_TRACE_ENTER,
EX(return_value) != NULL ? ZEND_JIT_TRACE_RETURN_VALUE_USED : 0, EX(return_value) != NULL ? ZEND_JIT_TRACE_RETURN_VALUE_USED : 0,
op_array); op_array);
@ -1069,6 +1080,10 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
/* TODO: Can we continue recording ??? */ /* TODO: Can we continue recording ??? */
stop = ZEND_JIT_TRACE_STOP_BAD_FUNC; stop = ZEND_JIT_TRACE_STOP_BAD_FUNC;
break; break;
} else if (EX(call)->func->common.prop_info) {
/* TODO: Can we continue recording ??? */
stop = ZEND_JIT_TRACE_STOP_PROP_HOOK_CALL;
break;
} }
func = EX(call)->func; func = EX(call)->func;
if (func->type == ZEND_INTERNAL_FUNCTION if (func->type == ZEND_INTERNAL_FUNCTION