8000 gh-104909: Implement conditional stack effects for macros by gvanrossum · Pull Request #105748 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104909: Implement conditional stack effects for macros #105748

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the test more thorough
  • Loading branch information
gvanrossum committed Jun 14, 2023
commit fb905d7fb36a862f1c329dc73e3d861f5a033c7e
11 changes: 8 additions & 3 deletions Tools/cases_generator/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ def test_cond_effect():

def test_macro_cond_effect():
input = """
op(A, (left, right --)) {
op(A, (left, middle, right --)) {
# Body of A
}
op(B, (-- extra if (oparg), res)) {
op(B, (-- deep, extra if (oparg), res)) {
# Body of B
}
macro(M) = A + B;
Expand All @@ -447,22 +447,27 @@ def test_macro_cond_effect():
TARGET(M) {
PyObject *_tmp_1 = stack_pointer[-1];
PyObject *_tmp_2 = stack_pointer[-2];
PyObject *_tmp_3 = stack_pointer[-3];
{
PyObject *right = _tmp_1;
PyObject *left = _tmp_2;
PyObject *middle = _tmp_2;
PyObject *left = _tmp_3;
# Body of A
}
{
PyObject *deep;
PyObject *extra = NULL;
PyObject *res;
# Body of B
_tmp_3 = deep;
if (oparg) { _tmp_2 = extra; }
_tmp_1 = res;
}
STACK_SHRINK(1);
STACK_GROW((oparg ? 1 : 0));
stack_pointer[-1] = _tmp_1;
if (oparg) { stack_pointer[-2] = _tmp_2; }
stack_pointer[-3] = _tmp_3;
DISPATCH();
}
"""
Expand Down
0