mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-106581: Honor 'always_exits' in write_components() (#109338)
I must have overlooked this when refactoring the code generator. The Tier 1 interpreter contained a few silly things like ``` goto resume_frame; STACK_SHRINK(1); ``` (and other variations, some where the unconditional `goto` was hidden in a macro).
This commit is contained in:
parent
d12b3e3152
commit
b86ce91bfe
2 changed files with 1 additions and 15 deletions
14
Python/generated_cases.c.h
generated
14
Python/generated_cases.c.h
generated
|
@ -803,7 +803,6 @@
|
||||||
SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR);
|
SKIP_OVER(INLINE_CACHE_ENTRIES_BINARY_SUBSCR);
|
||||||
frame->return_offset = 0;
|
frame->return_offset = 0;
|
||||||
DISPATCH_INLINED(new_frame);
|
DISPATCH_INLINED(new_frame);
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LIST_APPEND) {
|
TARGET(LIST_APPEND) {
|
||||||
|
@ -969,7 +968,6 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (true) { STACK_SHRINK(oparg); goto error; }
|
if (true) { STACK_SHRINK(oparg); goto error; }
|
||||||
STACK_SHRINK(oparg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(INTERPRETER_EXIT) {
|
TARGET(INTERPRETER_EXIT) {
|
||||||
|
@ -982,7 +980,6 @@
|
||||||
assert(!_PyErr_Occurred(tstate));
|
assert(!_PyErr_Occurred(tstate));
|
||||||
tstate->c_recursion_remaining += PY_EVAL_C_STACK_UNITS;
|
tstate->c_recursion_remaining += PY_EVAL_C_STACK_UNITS;
|
||||||
return retval;
|
return retval;
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(RETURN_VALUE) {
|
TARGET(RETURN_VALUE) {
|
||||||
|
@ -1044,7 +1041,6 @@
|
||||||
frame->prev_instr += frame->return_offset;
|
frame->prev_instr += frame->return_offset;
|
||||||
_PyFrame_StackPush(frame, retval);
|
_PyFrame_StackPush(frame, retval);
|
||||||
goto resume_frame;
|
goto resume_frame;
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(RETURN_CONST) {
|
TARGET(RETURN_CONST) {
|
||||||
|
@ -1388,7 +1384,6 @@
|
||||||
_PyErr_SetRaisedException(tstate, exc);
|
_PyErr_SetRaisedException(tstate, exc);
|
||||||
monitor_reraise(tstate, frame, next_instr-1);
|
monitor_reraise(tstate, frame, next_instr-1);
|
||||||
goto exception_unwind;
|
goto exception_unwind;
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(END_ASYNC_FOR) {
|
TARGET(END_ASYNC_FOR) {
|
||||||
|
@ -2210,8 +2205,6 @@
|
||||||
// don't want to specialize instrumented instructions
|
// don't want to specialize instrumented instructions
|
||||||
INCREMENT_ADAPTIVE_COUNTER(cache->counter);
|
INCREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||||
GO_TO_INSTRUCTION(LOAD_SUPER_ATTR);
|
GO_TO_INSTRUCTION(LOAD_SUPER_ATTR);
|
||||||
STACK_SHRINK(2);
|
|
||||||
STACK_GROW(((oparg & 1) ? 1 : 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(LOAD_SUPER_ATTR) {
|
TARGET(LOAD_SUPER_ATTR) {
|
||||||
|
@ -3422,7 +3415,6 @@
|
||||||
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
|
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
|
||||||
frame->return_offset = oparg;
|
frame->return_offset = oparg;
|
||||||
DISPATCH_INLINED(gen_frame);
|
DISPATCH_INLINED(gen_frame);
|
||||||
STACK_GROW(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(BEFORE_ASYNC_WITH) {
|
TARGET(BEFORE_ASYNC_WITH) {
|
||||||
|
@ -4032,8 +4024,6 @@
|
||||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL);
|
||||||
frame->return_offset = 0;
|
frame->return_offset = 0;
|
||||||
DISPATCH_INLINED(new_frame);
|
DISPATCH_INLINED(new_frame);
|
||||||
STACK_SHRINK(oparg);
|
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_NO_KW_TYPE_1) {
|
TARGET(CALL_NO_KW_TYPE_1) {
|
||||||
|
@ -4169,8 +4159,6 @@
|
||||||
* as it will be checked after start_frame */
|
* as it will be checked after start_frame */
|
||||||
tstate->py_recursion_remaining--;
|
tstate->py_recursion_remaining--;
|
||||||
goto start_frame;
|
goto start_frame;
|
||||||
STACK_SHRINK(oparg);
|
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(EXIT_INIT_CHECK) {
|
TARGET(EXIT_INIT_CHECK) {
|
||||||
|
@ -4453,8 +4441,6 @@
|
||||||
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
|
SKIP_OVER(INLINE_CACHE_ENTRIES_CALL + 1);
|
||||||
assert(next_instr[-1].op.code == POP_TOP);
|
assert(next_instr[-1].op.code == POP_TOP);
|
||||||
DISPATCH();
|
DISPATCH();
|
||||||
STACK_SHRINK(oparg);
|
|
||||||
STACK_SHRINK(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
|
TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) {
|
||||||
|
|
|
@ -457,7 +457,7 @@ def write_components(
|
||||||
with out.block(""):
|
with out.block(""):
|
||||||
mgr.instr.write_body(out, -4, mgr.active_caches, tier)
|
mgr.instr.write_body(out, -4, mgr.active_caches, tier)
|
||||||
|
|
||||||
if mgr is managers[-1] and not next_instr_is_set:
|
if mgr is managers[-1] and not next_instr_is_set and not mgr.instr.always_exits:
|
||||||
# Adjust the stack to its final depth, *then* write the
|
# Adjust the stack to its final depth, *then* write the
|
||||||
# pokes for all preceding uops.
|
# pokes for all preceding uops.
|
||||||
# Note that for array output effects we may still write
|
# Note that for array output effects we may still write
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue