summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h90
1 files changed, 57 insertions, 33 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 3822884..585e682 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -688,7 +688,10 @@
values = &stack_pointer[-oparg];
PyObject *set_o = PySet_New(NULL);
if (set_o == NULL) {
- goto error;
+ for (int _i = oparg; --_i >= 0;) {
+ PyStackRef_CLOSE(values[_i]);
+ }
+ if (true) { stack_pointer += -oparg; goto error; }
}
int err = 0;
for (int i = 0; i < oparg; i++) {
@@ -1744,15 +1747,18 @@
assert(self_o != NULL);
DEOPT_IF(!PyList_Check(self_o), CALL);
STAT_INC(CALL, hit);
- if (_PyList_AppendTakeRef((PyListObject *)self_o, PyStackRef_AsPyObjectSteal(arg)) < 0) {
- goto pop_1_error; // Since arg is DECREF'ed already
- }
+ int err = _PyList_AppendTakeRef((PyListObject *)self_o, PyStackRef_AsPyObjectSteal(arg));
PyStackRef_CLOSE(self);
PyStackRef_CLOSE(callable);
- STACK_SHRINK(3);
- // Skip POP_TOP
+ if (err) goto pop_3_error;
+ #if TIER_ONE
+ // Skip the following POP_TOP. This is done here in tier one, and
+ // during trace projection in tier two:
assert(next_instr->op.code == POP_TOP);
SKIP_OVER(1);
+ #endif
+ stack_pointer += -3;
+ assert(WITHIN_STACK_BOUNDS());
DISPATCH();
}
@@ -3488,7 +3494,7 @@
_PyStackRef res;
from = stack_pointer[-1];
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- PyObject *res_o = import_from(tstate, PyStackRef_AsPyObjectBorrow(from), name);
+ PyObject *res_o = _PyEval_ImportFrom(tstate, PyStackRef_AsPyObjectBorrow(from), name);
if (res_o == NULL) goto error;
res = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[0] = res;
@@ -3507,7 +3513,7 @@
fromlist = stack_pointer[-1];
level = stack_pointer[-2];
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- PyObject *res_o = import_name(tstate, frame, name,
+ PyObject *res_o = _PyEval_ImportName(tstate, frame, name,
PyStackRef_AsPyObjectBorrow(fromlist),
PyStackRef_AsPyObjectBorrow(level));
PyStackRef_CLOSE(level);
@@ -4980,22 +4986,16 @@
if (true) goto error;
}
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
- if (PyMapping_GetOptionalItem(mod_or_class_dict, name, &v_o) < 0) {
- goto error;
- }
+ if (PyMapping_GetOptionalItem(mod_or_class_dict, name, &v_o) < 0) goto error;
if (v_o == NULL) {
- if (PyDict_GetItemRef(GLOBALS(), name, &v_o) < 0) {
- goto error;
- }
+ if (PyDict_GetItemRef(GLOBALS(), name, &v_o) < 0) goto error;
if (v_o == NULL) {
- if (PyMapping_GetOptionalItem(BUILTINS(), name, &v_o) < 0) {
- goto error;
- }
+ if (PyMapping_GetOptionalItem(BUILTINS(), name, &v_o) < 0) goto error;
if (v_o == NULL) {
_PyEval_FormatExcCheckArg(
tstate, PyExc_NameError,
NAME_ERROR_MSG, name);
- goto error;
+ if (true) goto error;
}
}
}
@@ -5806,29 +5806,53 @@
}
TARGET(SEND_GEN) {
- _Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
+ frame->instr_ptr = next_instr;
next_instr += 2;
INSTRUCTION_STATS(SEND_GEN);
static_assert(INLINE_CACHE_ENTRIES_SEND == 1, "incorrect cache size");
_PyStackRef receiver;
_PyStackRef v;
+ _PyInterpreterFrame *gen_frame;
+ _PyInterpreterFrame *new_frame;
/* Skip 1 cache entry */
+ // _CHECK_PEP_523
+ {
+ DEOPT_IF(tstate->interp->eval_frame, SEND);
+ }
+ // _SEND_GEN_FRAME
v = stack_pointer[-1];
receiver = stack_pointer[-2];
- DEOPT_IF(tstate->interp->eval_frame, SEND);
- PyGenObject *gen = (PyGenObject *)PyStackRef_AsPyObjectBorrow(receiver);
- DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND);
- DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND);
- STAT_INC(SEND, hit);
- _PyInterpreterFrame *gen_frame = &gen->gi_iframe;
- STACK_SHRINK(1);
- _PyFrame_StackPush(gen_frame, v);
- gen->gi_frame_state = FRAME_EXECUTING;
- gen->gi_exc_state.previous_item = tstate->exc_info;
- tstate->exc_info = &gen->gi_exc_state;
- assert(next_instr - this_instr + oparg <= UINT16_MAX);
- frame->return_offset = (uint16_t)(next_instr - this_instr + oparg);
- DISPATCH_INLINED(gen_frame);
+ {
+ PyGenObject *gen = (PyGenObject *)PyStackRef_AsPyObjectBorrow(receiver);
+ DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND);
+ DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, SEND);
+ STAT_INC(SEND, hit);
+ gen_frame = &gen->gi_iframe;
+ _PyFrame_StackPush(gen_frame, v);
+ gen->gi_frame_state = FRAME_EXECUTING;
+ gen->gi_exc_state.previous_item = tstate->exc_info;
+ tstate->exc_info = &gen->gi_exc_state;
+ assert(1 + INLINE_CACHE_ENTRIES_SEND + oparg <= UINT16_MAX);
+ frame->return_offset = (uint16_t)(1 + INLINE_CACHE_ENTRIES_SEND + oparg);
+ }
+ // _PUSH_FRAME
+ new_frame = gen_frame;
+ {
+ // Write it out explicitly because it's subtly different.
+ // Eventually this should be the only occurrence of this code.
+ assert(tstate->interp->eval_frame == NULL);
+ stack_pointer += -1;
+ assert(WITHIN_STACK_BOUNDS());
+ _PyFrame_SetStackPointer(frame, stack_pointer);
+ new_frame->previous = frame;
+ CALL_STAT_INC(inlined_py_calls);
+ frame = tstate->current_frame = new_frame;
+ tstate->py_recursion_remaining--;
+ LOAD_SP();
+ LOAD_IP(0);
+ LLTRACE_RESUME_FRAME();
+ }
+ DISPATCH();
}
TARGET(SETUP_ANNOTATIONS) {