-
Notifications
You must be signed in to change notification settings - Fork 19
jit-trace: anchor an inlined level's walk-time traceback on its own frame #908
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
7c0c8b1
jit-trace: anchor an inlined level's walk-time traceback on its own f…
youknowone 6fe7a9a
bench, gate-triage: record the three blockers under the multi-frame a…
youknowone 8cf7471
gate-triage: record why the runtime half of the traceback anchor was …
youknowone 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
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
pyre/bench/synth/blackhole_inlined_callee_local_after_escape.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Guard for what an adopted multi-frame blackhole chain owes its inner levels. | ||
| # | ||
| # An inlined callee assigns a local, the frame then escapes through a residual | ||
| # `sys._getframe()`, and an attribute read POSITIONED AFTER that escape reads the | ||
| # local back. The read is executed by the blackhole, not by the walk, so the | ||
| # shape holds the adopt to two separate obligations and fails differently on | ||
| # each: | ||
| # | ||
| # * every LOAD_FAST lowers to `getarrayitem_vable_r` on the level's own frame | ||
| # array, so a level whose locals were left unpublished resumes `tb` as null | ||
| # and the attribute read faults in `object_getattr_miss` -- a hard SIGSEGV | ||
| # (rc=139) with no output at all; | ||
| # * the traceback the callee stored has to name the frame the callee runs on, | ||
| # so a walk-time node anchored on any other object prints `False` here while | ||
| # still exiting 0. | ||
| # | ||
| # The second is the quieter one and the reason the assertion is an identity | ||
| # rather than a liveness check. Both need the escape to happen inside an | ||
| # INLINED callee: the same shape through the single-frame arm was always | ||
| # correct. | ||
| # | ||
| # Deliberately carries no `# pyre-check: max-pypy-ratio=` header: this guards an | ||
| # output, and the forcing read makes it a poor perf subject. | ||
| import sys | ||
|
|
||
| N = 20000 | ||
|
|
||
|
|
||
| def catches_here(i): | ||
| try: | ||
| raise ValueError(i) | ||
| except ValueError as e: | ||
| tb = e.__traceback__ | ||
| f = sys._getframe() | ||
| return (tb.tb_frame is f, tb.tb_lineno - f.f_code.co_firstlineno) | ||
|
|
||
|
|
||
| def drive(): | ||
| seen = set() | ||
| k = 0 | ||
| while k < N: | ||
| seen.add(catches_here(k)) | ||
| k += 1 | ||
| return sorted(seen) | ||
|
|
||
|
|
||
| print(drive()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This selects the seeded callee frame only for
execute_concrete; the runtime arm below still emits the frame-fabricating inline hook. That arm is reachable when an inlined callee explicitly raises a promoted constant exception (for example, a module-global exception instance), becauserecord_prepend_application_tracebackreturns false forexc.is_constant(). The recording/adopted iteration will therefore attach the live frame here, while compiled iterations attach a different fabricated frame, soexc.__traceback__.tb_frame is sys._getframe()changes across iterations. The emitted path must preserve the same per-frame identity, or the affected shape must be declined until it can.AGENTS.md reference: AGENTS.md:L32-L42
Useful? React with 👍 / 👎.