Skip to content

Improve JIT TRACE coverage #16171

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

Merged
merged 1 commit into from
Oct 2, 2024
Merged

Improve JIT TRACE coverage #16171

merged 1 commit into from
Oct 2, 2024

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Oct 2, 2024

Now PHP tracing JIT may lose some parts of the "hot" code.

In case we have a root LOOP trace with an inlined call of some function, and we get a SIDE exit inside that function - we start recording a side trace, but we finish recording at the RETURN of the inlined function. As result the opcodes between RETURN from SIDE trace and root trace LOOP exit might be never traced and were always executed in interpreter.

This patch introduces a "ret_depth" argument that prevents stopping tracing on RETURN of such SIDE trace.

This is targeted to PHP-8.4, because this may disclose unrelated JIT problems and I don't like to do this in old stable releases.

Now it's possible that PHP tracing JIT loses some parts of the "hot"
code. In case we have a root LOOP trace with an inlined call of some
function, and we get a SIDE exit inside that function - we recorded a
side trace, but finished it a the RETURN of the inlined function. As
result the opcodes betwee RETURN from SIDE trace and LOOP exit were not
covered by tracer and were executed in interpreter.

This patch introduces a "ret_depth" argument that prevents stopping
tracing on RETURN of such SIDE trace.
Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

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

I only have limited knowledge so far about how the tracing step works, but the code and logic make sense to me.

@dstogov dstogov merged commit ddc4915 into php:PHP-8.4 Oct 2, 2024
10 checks passed
dstogov added a commit that referenced this pull request Oct 2, 2024
* PHP-8.4:
  Improve JIT TRACE coverage (#16171)
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