-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
GH-96421: Insert shim frame on entry to interpreter #96319
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 1 commit
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
4d5e9a5
Handle _PyEval_EvalFrameDefault exit in bytecode.
markshannon cf78d2b
Merge branch 'main' into entry-frame
markshannon 7f5348a
Get entry frame shim working.
markshannon 59e7727
Delay destruction of trampoline code object and make symbol private
markshannon 9f710e6
Make sure that previous never points into the C stack after return.
markshannon 4ee84ab
Use explicit stacksize in _Py_MakeTrampoline. Allow interpreter to cl…
markshannon f5161e3
Move assert before use.
markshannon 06c2ad6
Use typedef name.
markshannon cb6134e
Merge branch 'main' into entry-frame
markshannon 11b3b17
Merge branch 'main' into entry-frame
markshannon 053f488
More on-stack C structs into a big struct and add sentinels, as we wa…
markshannon 4dad69a
Skip a test if ASAN is turned on.
markshannon 0db3b25
Remove extra semicolons.
markshannon 05b4f68
Add news
markshannon 6cca61c
Merge branch 'main' into entry-frame
markshannon 5099861
Merge branch 'main' into entry-frame
markshannon 4015c72
Halve the number of writes for shim frame.
markshannon fb19e94
Remove one more write to shim frame.
markshannon 95ef81b
Fix lltrace
markshannon 972425d
Merge branch 'main' into entry-frame
markshannon aa8bd73
Remove first_instr local variable.
markshannon f7072e1
Add news and update frame_layout.md
markshannon 52406d2
Merge branch 'main' into entry-frame
markshannon bd2b0ee
Remove debugging scaffolding and give C compiler more freedom to layo…
markshannon 10b03c8
Remove typo
markshannon b62f5f3
Address code review comments.
markshannon 1a0b08f
Generate linetable when creating shim code.
markshannon 76e437a
Bundle shim code definition into single struct.
markshannon 945e26a
Remove incorrect assert.
markshannon 676321a
assert generator is cleared after returning or raising.
markshannon 3cb22e6
Rename pyframe to entry_frame.
markshannon e5dcbd9
Pass correct length.
markshannon bd29356
Address review comments
markshannon 9446325
Merge branch 'main' into entry-frame
markshannon f6a6457
Post merge cleanup
markshannon d113655
Turn ASAN back on for subprocess test.
markshannon ed7af1e
Apply suggestions from code review
markshannon 48410d9
Merge branch 'main' into entry-frame
markshannon 7cda3ef
Merge branch 'main' into entry-frame
markshannon 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
Address code review comments.
- Loading branch information
commit b62f5f3506b86c4ccb555ad76def3823d79feb3c
There are no files selected for viewing
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
4 changes: 0 additions & 4 deletions
4
Misc/NEWS.d/next/Core and Builtins/2022-09-09-10-37-34.gh-issue-96421.cyg33z.rst
This file was deleted.
Oops, something went wrong.
18 changes: 14 additions & 4 deletions
18
Misc/NEWS.d/next/Core and Builtins/2022-10-19-15-59-08.gh-issue-96421.e22y3r.rst
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 |
---|---|---|
@@ -1,4 +1,14 @@ | ||
On entry to ``PyEval_EvalFrameDefault()`` an additional, internal, shim | ||
frame is pushed. This simplifies the return and yield bytecode instructions. | ||
Only debuggers and profiles that inspect the stack of frames should be | ||
impacted. | ||
When calling into Python code from C code, though ``PyEval_EvalFrame`` or | ||
related C-API function, a shim frame in inserted into the call stack. | ||
This occurs in the ``_PyEval_EvalFrameDefault()`` function. | ||
The extra frame should be invisible to all Python and most C extensions, | ||
but out-of-process debuggers, profilers and debuggers need to be aware of | ||
it. | ||
These shim frames can be detected by checking | ||
``frame->owner == FRAME_OWNED_BY_CSTACK``. | ||
|
||
Extensions implementing their own interpreters using PEP 523 need to be | ||
aware of this shim frame and the changes to the semantics of | ||
``RETURN_VALUE``, ``YIELD_VALUE``, and ``RETURN_GENERATOR``, | ||
which now clear the frame. | ||
|
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.