-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
gh-143183: Rewind stop tracing to previous target #143187
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
tomasr8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits, otherwise looks good!
| // gh-143183: It's important we rewind to the last known proper target. | ||
| // The current target might be garbage as stop tracing usually indicates | ||
| // we are in something that we can't trace. | ||
| goto unsupported; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth to add a DPRINTF() here? All the other goto unsupported have it
| if (opcode == BINARY_OP_SUBSCR_GETITEM && old_stack_level + 1 > old_code->co_stacksize) { | ||
| unsupported: | ||
| { | ||
| // Rewind to previous instruction and replace with _EXIT_TRACE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Rewind to previous instruction and replace with exit_op. |
| except StopIteration: | ||
| break | ||
| for _ in range({TIER2_THRESHOLD // 40}): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, does the number of iterations depend on TIER2_THRESHOLD? Why specifically 40?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's too high, the test takes forever to run. So this just makes sure we have a number high enough that triggers without taking too long.
Fixes #143183
stopiteration_error#143183