mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
GH-135379: Remove types from stack items in code generator. (GH-135384)
* Make casts explicit in the instruction definitions
This commit is contained in:
parent
49d72365cd
commit
c87b5b2cb6
13 changed files with 257 additions and 255 deletions
|
|
@ -56,14 +56,14 @@ class TestEffects(unittest.TestCase):
|
|||
def test_effect_sizes(self):
|
||||
stack = Stack()
|
||||
inputs = [
|
||||
x := StackItem("x", None, "1"),
|
||||
y := StackItem("y", None, "oparg"),
|
||||
z := StackItem("z", None, "oparg*2"),
|
||||
x := StackItem("x", "1"),
|
||||
y := StackItem("y", "oparg"),
|
||||
z := StackItem("z", "oparg*2"),
|
||||
]
|
||||
outputs = [
|
||||
StackItem("x", None, "1"),
|
||||
StackItem("b", None, "oparg*4"),
|
||||
StackItem("c", None, "1"),
|
||||
StackItem("x", "1"),
|
||||
StackItem("b", "oparg*4"),
|
||||
StackItem("c", "1"),
|
||||
]
|
||||
null = CWriter.null()
|
||||
stack.pop(z, null)
|
||||
|
|
@ -1103,32 +1103,6 @@ def test_array_of_one(self):
|
|||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_pointer_to_stackref(self):
|
||||
input = """
|
||||
inst(OP, (arg: _PyStackRef * -- out)) {
|
||||
out = *arg;
|
||||
DEAD(arg);
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
TARGET(OP) {
|
||||
#if Py_TAIL_CALL_INTERP
|
||||
int opcode = OP;
|
||||
(void)(opcode);
|
||||
#endif
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP);
|
||||
_PyStackRef *arg;
|
||||
_PyStackRef out;
|
||||
arg = (_PyStackRef *)stack_pointer[-1].bits;
|
||||
out = *arg;
|
||||
stack_pointer[-1] = out;
|
||||
DISPATCH();
|
||||
}
|
||||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_unused_cached_value(self):
|
||||
input = """
|
||||
op(FIRST, (arg1 -- out)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue