Skip to content

Provide script to TSSA build in tracing JIT #18353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
@@ -4117,6 +4117,14 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par

checkpoint = zend_arena_checkpoint(CG(arena));

zend_accel_hash_entry *accel_h_entry = zend_accel_hash_find_entry(&ZCSG(hash), trace_buffer->op_array->filename);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly this can fetch a different version of the script (e.g. if the file was discarded and recompiled).

An alternative would be to store the script into zend_jit_op_array_trace_extension. (After op_array, as I believe the func_info and op_array fields must be at the same offset in all zend_jit_*_extension structs.)

if (accel_h_entry) {
zend_persistent_script *persistent_script = (zend_persistent_script *) accel_h_entry->data;
if (!persistent_script->corrupted) {
script = &persistent_script->script;
}
}

ssa = zend_jit_trace_build_tssa(trace_buffer, parent_trace, exit_num, script, op_arrays, &num_op_arrays);

if (!ssa) {
Loading