Revert "GH-128914: Remove conditional stack effects from bytecodes.c and the code generators (GH-128918)" (GH-129202)

The commit introduced a ~2.5-3% regression in the free threading build.

This reverts commit ab61d3f430.
This commit is contained in:
Sam Gross 2025-01-23 04:26:25 -05:00 committed by GitHub
parent d7d066c3ab
commit a10f99375e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 1679 additions and 1460 deletions

View file

@ -1261,18 +1261,27 @@ mark_stacks(PyCodeObject *code_obj, int len)
stacks[next_i] = next_stack;
break;
case LOAD_GLOBAL:
{
int j = oparg;
next_stack = push_value(next_stack, Object);
if (j & 1) {
next_stack = push_value(next_stack, Null);
}
stacks[next_i] = next_stack;
break;
}
case LOAD_ATTR:
{
assert(top_of_stack(next_stack) == Object);
int j = oparg;
if (j & 1) {
next_stack = pop_value(next_stack);
next_stack = push_value(next_stack, Object);
next_stack = push_value(next_stack, Null);
}
stacks[next_i] = next_stack;
break;
case LOAD_METHOD:
assert(top_of_stack(next_stack) == Object);
next_stack = push_value(next_stack, Null);
stacks[next_i] = next_stack;
break;
}
case SWAP:
{
int n = oparg;