Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-107557: Setup abstract interpretation#107847
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
d20fbb82aeea511a728ab17fccbca1da69db458e17f81f88800203201f93072dac63e3e62e015a7f654cf4040b8ec581454292767fdcca905110fb99f443a27632ed10d0c4c44c8953e3bd36fa229097fca0fab768c684f46c5777b839ee46ecf3d2b6eeb25d5cceb98c0d65f95db9091e05ef8d7d8b524d7abc73d76f9ae81def29a5a3f7df490d01e4fc946de77a7a11fc80c61015b56c62eb3c08ebed5f16be1e61c496c24b492be404d29e255d3c44117b758b4780c7f186a2b204File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2643,5 +2643,6 @@ def testfunc(loops): | ||
| binop_count = [opname for opname, _, _ in ex if opname == "_BINARY_OP_ADD_INT"] | ||
| self.assertEqual(len(binop_count), 1) | ||
Fidget-Spinner marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| if __name__ == "__main__": | ||
| unittest.main() | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3743,13 +3743,12 @@ dummy_func( | ||
| return frame; | ||
| } | ||
| op(INSERT, (stuff[oparg], top -- top, stuff[oparg])) { | ||
Fidget-Spinner marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| // Inserts TOS at position specified by oparg | ||
| PyObject *tos = TOP(); | ||
| for (int i = 1; i < oparg + 1; i++) { | ||
| stack_pointer[i] = stack_pointer[i - 1]; | ||
| ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -61,7 +61,7 @@ | ||
| INSTR_FMT_PREFIX = "INSTR_FMT_" | ||
| # TODO: generate all these after updating the DSL | ||
| SPECIALLY_HANDLED_ABSTRACT_INSTR = { | ||
| "LOAD_FAST", | ||
| "LOAD_FAST_CHECK", | ||
| @@ -135,7 +135,7 @@ def effect_str(effects: list[StackEffect]) -> str: | ||
| pushed: str | None | ||
| match thing: | ||
| case parsing.InstDef(): | ||
| if thing.kind== "instr" or self.instrs[thing.name].is_viable_uop(): | ||
| instr = self.instrs[thing.name] | ||
| popped = effect_str(instr.input_effects) | ||
| pushed = effect_str(instr.output_effects) | ||
| @@ -641,17 +641,14 @@ def write_abstract_interpreter_instructions( | ||
| for thing in self.everything: | ||
| match thing: | ||
| case OverriddenInstructionPlaceHolder(): | ||
| pass | ||
| case parsing.InstDef(): | ||
| instr = AbstractInstruction(self.instrs[thing.name].inst) | ||
| if instr.is_viable_uop() and instr.name not in SPECIALLY_HANDLED_ABSTRACT_INSTR: | ||
| self.out.emit("") | ||
| with self.out.block(f"case {thing.name}:"): | ||
| instr.write(self.out, tier=TIER_TWO) | ||
Member 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. Note that ingh-107760 I'm removing Member 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. I wonder if you even need the MemberAuthor 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. I was thinking of how we might need to expand on it more in the future, so a separate class might be better. Member 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. When that happens in the future you can refactor the code. Until then, I recommend less code. As you may have noticed this code gets refactored a lot. :-) It's easy because the generator is not a public API -- all we care about is whether it generates a handful of files correctly from bytecodes.c at build time. But I worry about copying and pasting code, because that's harder to refactor. | ||
| self.out.emit("break;") | ||
| case parsing.Macro(): | ||
| pass | ||
| case parsing.Pseudo(): | ||