gh-106581: Support multiple uops pushing new values (#108895)

Also avoid the need for the awkward .clone() call in the argument
to mgr.adjust_inverse() and mgr.adjust().
This commit is contained in:
Guido van Rossum 2023-09-05 13:58:39 -07:00 committed by GitHub
parent 2c4c26c4ce
commit b87263be9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 19 deletions

View file

@ -532,6 +532,36 @@ class TestGeneratedCases(unittest.TestCase):
"""
self.run_cases_test(input, output)
def test_macro_push_push(self):
input = """
op(A, (-- val1)) {
val1 = spam();
}
op(B, (-- val2)) {
val2 = spam();
}
macro(M) = A + B;
"""
output = """
TARGET(M) {
PyObject *val1;
PyObject *val2;
// A
{
val1 = spam();
}
// B
{
val2 = spam();
}
STACK_GROW(2);
stack_pointer[-2] = val1;
stack_pointer[-1] = val2;
DISPATCH();
}
"""
self.run_cases_test(input, output)
if __name__ == "__main__":
unittest.main()