forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 4
Feat: Implemented type propagation #24
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
Fidget-Spinner
merged 21 commits into
Fidget-Spinner:tier2_interpreter_no_separate_eval_no_tracer_contiguous_bbs
from
JuliaPoo:types_metainterpreter
Mar 2, 2023
Merged
Feat: Implemented type propagation #24
Fidget-Spinner
merged 21 commits into
Fidget-Spinner:tier2_interpreter_no_separate_eval_no_tracer_contiguous_bbs
from
JuliaPoo:types_metainterpreter
Mar 2, 2023
Conversation
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
…_bbs' into types_metainterpreter
…mplementing the types meta-interpreter
…_bbs' into types_metainterpreter # Conflicts: # Include/internal/pycore_opcode_macro_to_micro.h
Might require a refactor of the tier2 bytecode emitting code to progress. When emitting from a codeobject (with tier1 bytecode): 1. deop inst back to tier0 2. emit tier2 inst based on current type context 3. type propagate through emitted inst This allows the type propagator to work with tier2 bytecode (which contains more information) and can probably be generated from the DSL
…conditional stack effect
In preparation for type propagating within the tier2 branch handling code
Co-authored-by: Ken Jin <[email protected]>
Co-authored-by: Ken Jin <[email protected]>
Co-authored-by: Ken Jin <[email protected]>
…python into types_metainterpreter
eeaa02f
into
Fidget-Spinner:tier2_interpreter_no_separate_eval_no_tracer_contiguous_bbs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull requests contains:
bytecode.c
for the type propagationExample:
tier2_typepropagator.c.h
which is inlined intotier2.c
. This file deals with type propagation across all tier2 bytecode except forBB_TEST_IF_FALSE_OR_POP
andBB_TEST_IF_TRUE_OR_POP
because it's stack effect is dependent on branch takenDISPATCH()
call in_PyTier2_Code_DetectAndEmitBB
, which accounts for all tier2 bytecode except branch instructionsemit_logical_branch
, which deals with type propagation except for the two above mentioned instructionsBB_BRANCH
, where bothBB_TEST_IF_FALSE_OR_POP
andBB_TEST_IF_TRUE_OR_POP
sets a flaggen_bb_requires_pop
during runtime which gets used inBB_BRANCH
to perform the corresponding pop on the type context for the next BB.Other misc (but important) changes:
type_context
is now its own struct_PyTier2_Code_DetectAndEmitBB
no longer makes a copy of thetype_context
and instead modifies the type context passed into it. Callers of this function should make a copy if needed.Future work:
type_context
from a BB who's target branches have all been generated can be reused without additional allocations, since said BB doesn't require atype_context
anymore.