Skip to content

Stop side exit tracing when reach max_root_trace #9964

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

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -7894,6 +7894,8 @@ int ZEND_FASTCALL zend_jit_trace_hot_side(zend_execute_data *execute_data, uint3
zend_jit_trace_rec trace_buffer[ZEND_JIT_TRACE_MAX_LENGTH];
uint32_t is_megamorphic = 0;
uint32_t polymorphism = 0;
uint32_t i;
uint32_t j;

trace_num = ZEND_JIT_TRACE_NUM;

Expand All @@ -7915,6 +7917,15 @@ int ZEND_FASTCALL zend_jit_trace_hot_side(zend_execute_data *execute_data, uint3

if (ZEND_JIT_TRACE_NUM >= JIT_G(max_root_traces)) {
stop = ZEND_JIT_TRACE_STOP_TOO_MANY_TRACES;
/* Traverse all JITed code, restore side exit to vm execution */
for (i = 1; i < ZEND_JIT_TRACE_NUM; i++) {
for (j = 0; j < zend_jit_traces[i].exit_count; j++) {
zend_jit_blacklist_trace_exit(i, j);
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense to avoid calling zend_jit_blacklist_trace_exit() for already jit-ed and blacklisted side exits. This would remove unnecessary locks.

}
}
if (JIT_G(debug) & ZEND_JIT_DEBUG_TRACE_BLACKLIST) {
fprintf(stderr, "---- All side exits are blacklisted");
}
goto abort;
}

Expand Down