Skip to content

Stop side exit tracing when reach max_root_trace#9964

Open
wxue1 wants to merge 1 commit intophp:masterfrom
wxue1:stop_side_exit_tracing1
Open

Stop side exit tracing when reach max_root_trace#9964
wxue1 wants to merge 1 commit intophp:masterfrom
wxue1:stop_side_exit_tracing1

Conversation

@wxue1
Copy link
Contributor

@wxue1 wxue1 commented Nov 17, 2022

When max_root_trace is reached, tracing JIT will not compile any new code for side trace, but side exit tracing is still going on. Stop it immediately instead of lazy blacklisting. This reduces JIT cost and potentially improve PHP execution efficiency.

Signed-off-by: Wang, Xue xue1.wang@intel.com
Reviewed-by: Chen, Hu hu1.chen@intel.com
Reviewed-by: Su, Tao tao.su@intel.com

When max_root_trace is reached, tracing JIT will not compile
any new code for side trace, but side exit tracing is still
going on. Stop it immediately instead of lazy blacklisting.
This reduces JIT cost and potentially improve PHP execution
efficiency.

Signed-off-by: Wang, Xue   <xue1.wang@intel.com>
Reviewed-by:   Chen, Hu    <hu1.chen@intel.com>
Reviewed-by:   Su, Tao     <tao.su@intel.com>
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

I'm not sure if this is the right decision.

Blacklisting includes code generation for deoptimization. This is not a cheap process and doing this for all side exits at once may take significant time. Many side exits are never used and code generation for them is useless and will lead to additional code bloat.

I'm open for your arguments.

/* 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants