FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove support for legacy bytecode instructions by gvanrossum · Pull Request #105705 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 1 addition & 3 deletions Tools/cases_generator/generate_cases.py
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
Expand Up @@ -230,7 +230,7 @@ class Instruction:

# Parts of the underlying instruction definition
inst: parser.InstDef
kind: typing.Literal["inst", "op", "legacy"] # Legacy means no (input -- output)
kind: typing.Literal["inst", "op"]
name: str
block: parser.Block
block_text: list[str] # Block.text, less curlies, less PREDICT() calls
Expand Down Expand Up @@ -856,8 +856,6 @@ def get_stack_effect_info(
self, thing: parser.InstDef | parser.Macro | parser.Pseudo
) -> tuple[AnyInstruction | None, str, str]:
def effect_str(effects: list[StackEffect]) -> str:
if getattr(thing, "kind", None) == "legacy":
return str(-1)
n_effect, sym_effect = list_effect_size(effects)
if sym_effect:
return f"{sym_effect} + {n_effect}" if n_effect else sym_effect
Expand Down
7 changes: 2 additions & 5 deletions Tools/cases_generator/parser.py
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
Expand Up @@ -101,7 +101,7 @@ class OpName(Node):
class InstHeader(Node):
override: bool
register: bool
kind: Literal["inst", "op", "legacy"] # Legacy means no (inputs -- outputs)
kind: Literal["inst", "op"]
name: str
inputs: list[InputEffect]
outputs: list[OutputEffect]
Expand All @@ -111,7 +111,7 @@ class InstHeader(Node):
class InstDef(Node):
override: bool
register: bool
kind: Literal["inst", "op", "legacy"]
kind: Literal["inst", "op"]
name: str
inputs: list[InputEffect]
outputs: list[OutputEffect]
Expand Down Expand Up @@ -174,9 +174,6 @@ def inst_header(self) -> InstHeader | None:
if self.expect(lx.RPAREN):
if (tkn := self.peek()) and tkn.kind == lx.LBRACE:
return InstHeader(override, register, kind, name, inp, outp)
elif self.expect(lx.RPAREN) and kind == "inst":
# No legacy stack effect if kind is "op".
return InstHeader(override, register, "legacy", name, [], [])
return None

def io_effect(self) -> tuple[list[InputEffect], list[OutputEffect]]:
Expand Down
14 changes: 0 additions & 14 deletions Tools/cases_generator/test_generator.py
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
Expand Up @@ -62,20 +62,6 @@ def run_cases_test(input: str, expected: str):
# print("End")
assert actual.rstrip() == expected.rstrip()

def test_legacy():
input = """
inst(OP) {
spam();
}
"""
output = """
TARGET(OP) {
spam();
DISPATCH();
}
"""
run_cases_test(input, output)

def test_inst_no_args():
input = """
inst(OP, (--)) {
Expand Down

Back | FazBrowse Home | New Git URL