-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Support RETURN from tracing through a function #107925
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
Conversation
This is only the first step for doing `CALL` in Tier 2. The next step involves tracing into the called code object. After that we'll have to do the remaining `CALL` specialization. Finally we'll have to tweak various things like `KW_NAMES`, and possibly move the `NULL` (for method calls) *above* the callable. But those are things for future PRs. Note: this moves setting `frame->return_offset` directly in front of `DISPATCH_INLINED()`, to make it easier to move it into `_PUSH_FRAME`.
Instead, the special case is an opcode using SAVE_FRAME_STATE(). Introducing #if TIER_ONE and #if TIER_TWO so we can implement _PUSH_FRAME differently for both tiers.
Instead, we special-case SAVE_IP: - Its Tier 2 expansion sets oparg to the instruction offset - In Tier 1 it is a no-op (and skipped if present in a macro)
Running tests with |
This should be easy -- require that every function has at least one stack slot. The compiler guarantees that there is nothing on the stack below the return value, so RETURN_CONST would always start with an empty stack. |
- This uses the function-by-version cache I just added - There's not yet a way to trace back via `RETURN_VALUE`
This should fix leaks and hopefully most failing tests.
Macros not using oparg should have a format starting with IX, not IB. This corrects the metadata for a bunch of specializations, e.g. BINARY_OP_MULTIPLY_INT (which never looks at oparg).
Seems to fix test_opcache, playing games with func.__code__ = func.__code__.replace().
47d56f1
to
d90ecaf
Compare
This depends on gh-107793.