-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
[WIP] bpo-17611: Move unwinding of stack from interpreter to compiler #2827
Closed
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
656e4f3
bpo-17611: Move unwinding of stack from interpreter to compiler
pitrou c8068ab
Cleanup
pitrou b699364
Improve stack size calculation for SETUP_{EXCEPT,FINALLY}
pitrou 541e7ce
Update frozen importlib
pitrou d3dc002
Remove useless code
pitrou b6d597c
Don't predict FOR_ITER as it breaks tracing without computed gotos
pitrou 31e46dc
Remove dead code and fix tracing tests
pitrou 693b939
Fix test_dis
pitrou d6ca2b9
Add JUMP_FINALLY to avoid finally block duplication
pitrou aefdbd1
Remove finally block duplication
pitrou 9d12612
More precise computation of code object stack size
pitrou 4ce87b6
JUMP_FINALLY pushes 6 values to be consistent with the effect of an e…
pitrou 029f825
Exact stack size computation by popping stale exception state in RERAISE
pitrou bd0167f
Remove the now pointless POP_MANY
pitrou e5c1db6
Add comment for RERAISE
pitrou 0ec9d12
Remove JUMP_FINALLY
pitrou 9c3cfd0
Remove last block duplication
pitrou 9a420d1
Get rid of END_ITER
pitrou 336808c
Fix comments in frameobject.c
pitrou 61ee3fa
Add stack size tests
pitrou 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
This file contains 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 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 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 |
---|---|---|
|
@@ -2075,9 +2075,19 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) | |
PyObject *exc = POP(); | ||
PyObject *val = POP(); | ||
PyObject *tb = POP(); | ||
assert(PyExceptionClass_Check(exc)); | ||
PyErr_Restore(exc, val, tb); | ||
goto exception_unwind; | ||
if (exc == Py_None) { | ||
assert(val == Py_None); | ||
assert(tb == Py_None); | ||
Py_DECREF(exc); | ||
Py_DECREF(val); | ||
Py_DECREF(tb); | ||
} | ||
else { | ||
assert(PyExceptionClass_Check(exc)); | ||
PyErr_Restore(exc, val, tb); | ||
goto exception_unwind; | ||
} | ||
FAST_DISPATCH(); | ||
} | ||
|
||
TARGET(LOAD_BUILD_CLASS) { | ||
|
@@ -2844,6 +2854,18 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) | |
FAST_DISPATCH(); | ||
} | ||
|
||
TARGET(JUMP_FINALLY) { | ||
PyObject *exc = Py_None; | ||
Py_INCREF(exc); | ||
Py_INCREF(exc); | ||
Py_INCREF(exc); | ||
PUSH(exc); | ||
PUSH(exc); | ||
PUSH(exc); | ||
JUMPBY(oparg); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it needed? It seems to me that JUMP_FINALLY always jumps to the next instruction. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That might be, I'll give it a try. |
||
FAST_DISPATCH(); | ||
} | ||
|
||
PREDICTED(POP_JUMP_IF_FALSE); | ||
TARGET(POP_JUMP_IF_FALSE) { | ||
PyObject *cond = POP(); | ||
|
This file contains 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 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 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.
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.
Can we push 3 NULLs?
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.
Yes.