Skip to content

Commit 54965f3

Browse files
authored
GH-130296: Avoid stack transients in four instructions. (GH-130310)
* Combine _GUARD_GLOBALS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_MODULE_FROM_KEYS into _LOAD_GLOBAL_MODULE * Combine _GUARD_BUILTINS_VERSION_PUSH_KEYS and _LOAD_GLOBAL_BUILTINS_FROM_KEYS into _LOAD_GLOBAL_BUILTINS * Combine _CHECK_ATTR_MODULE_PUSH_KEYS and _LOAD_ATTR_MODULE_FROM_KEYS into _LOAD_ATTR_MODULE * Remove stack transient in LOAD_ATTR_WITH_HINT
1 parent ab11c09 commit 54965f3

15 files changed

+599
-989
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 179 additions & 176 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_ids.h

Lines changed: 147 additions & 153 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 13 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/test/test_generated_cases.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,55 +1931,6 @@ def test_pystackref_frompyobject_new_next_to_cmacro(self):
19311931
"""
19321932
self.run_cases_test(input, output)
19331933

1934-
def test_pop_input(self):
1935-
input = """
1936-
inst(OP, (a, b --)) {
1937-
POP_INPUT(b);
1938-
HAM(a);
1939-
INPUTS_DEAD();
1940-
}
1941-
"""
1942-
output = """
1943-
TARGET(OP) {
1944-
#if Py_TAIL_CALL_INTERP
1945-
int opcode = OP;
1946-
(void)(opcode);
1947-
#endif
1948-
frame->instr_ptr = next_instr;
1949-
next_instr += 1;
1950-
INSTRUCTION_STATS(OP);
1951-
_PyStackRef a;
1952-
_PyStackRef b;
1953-
b = stack_pointer[-1];
1954-
a = stack_pointer[-2];
1955-
stack_pointer += -1;
1956-
assert(WITHIN_STACK_BOUNDS());
1957-
HAM(a);
1958-
stack_pointer += -1;
1959-
assert(WITHIN_STACK_BOUNDS());
1960-
DISPATCH();
1961-
}
1962-
"""
1963-
self.run_cases_test(input, output)
1964-
1965-
def test_pop_input_with_empty_stack(self):
1966-
input = """
1967-
inst(OP, (--)) {
1968-
POP_INPUT(foo);
1969-
}
1970-
"""
1971-
with self.assertRaises(SyntaxError):
1972-
self.run_cases_test(input, "")
1973-
1974-
def test_pop_input_with_non_tos(self):
1975-
input = """
1976-
inst(OP, (a, b --)) {
1977-
POP_INPUT(a);
1978-
}
1979-
"""
1980-
with self.assertRaises(SyntaxError):
1981-
self.run_cases_test(input, "")
1982-
19831934
def test_no_escaping_calls_in_branching_macros(self):
19841935

19851936
input = """

0 commit comments

Comments
 (0)