mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
GH-111485: Remove some special cases from the code generator and bytecodes.c (GH-111540)
This commit is contained in:
parent
d27acd4461
commit
2904d99839
8 changed files with 119 additions and 55 deletions
18
Python/generated_cases.c.h
generated
18
Python/generated_cases.c.h
generated
|
@ -1090,6 +1090,7 @@
|
|||
INSTRUCTION_STATS(RAISE_VARARGS);
|
||||
PyObject **args;
|
||||
args = stack_pointer - oparg;
|
||||
TIER_ONE_ONLY
|
||||
PyObject *cause = NULL, *exc = NULL;
|
||||
switch (oparg) {
|
||||
case 2:
|
||||
|
@ -1532,6 +1533,7 @@
|
|||
PyObject **values;
|
||||
exc = stack_pointer[-1];
|
||||
values = stack_pointer - 1 - oparg;
|
||||
TIER_ONE_ONLY
|
||||
assert(oparg >= 0 && oparg <= 2);
|
||||
if (oparg) {
|
||||
PyObject *lasti = values[0];
|
||||
|
@ -1560,6 +1562,7 @@
|
|||
PyObject *awaitable;
|
||||
exc = stack_pointer[-1];
|
||||
awaitable = stack_pointer[-2];
|
||||
TIER_ONE_ONLY
|
||||
assert(exc && PyExceptionInstance_Check(exc));
|
||||
if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) {
|
||||
Py_DECREF(awaitable);
|
||||
|
@ -1587,6 +1590,7 @@
|
|||
exc_value = stack_pointer[-1];
|
||||
last_sent_val = stack_pointer[-2];
|
||||
sub_iter = stack_pointer[-3];
|
||||
TIER_ONE_ONLY
|
||||
assert(throwflag);
|
||||
assert(exc_value && PyExceptionInstance_Check(exc_value));
|
||||
if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) {
|
||||
|
@ -2107,7 +2111,7 @@
|
|||
PyObject *initial = GETLOCAL(oparg);
|
||||
PyObject *cell = PyCell_New(initial);
|
||||
if (cell == NULL) {
|
||||
goto resume_with_error;
|
||||
goto error;
|
||||
}
|
||||
SETLOCAL(oparg, cell);
|
||||
DISPATCH();
|
||||
|
@ -3282,6 +3286,7 @@
|
|||
PyObject *res;
|
||||
fromlist = stack_pointer[-1];
|
||||
level = stack_pointer[-2];
|
||||
TIER_ONE_ONLY
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||
res = import_name(tstate, frame, name, fromlist, level);
|
||||
Py_DECREF(level);
|
||||
|
@ -3299,6 +3304,7 @@
|
|||
PyObject *from;
|
||||
PyObject *res;
|
||||
from = stack_pointer[-1];
|
||||
TIER_ONE_ONLY
|
||||
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg);
|
||||
res = import_from(tstate, from, name);
|
||||
if (res == NULL) goto error;
|
||||
|
@ -3317,11 +3323,11 @@
|
|||
|
||||
TARGET(JUMP_BACKWARD) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(JUMP_BACKWARD);
|
||||
CHECK_EVAL_BREAKER();
|
||||
assert(oparg <= INSTR_OFFSET());
|
||||
JUMPBY(1-oparg);
|
||||
JUMPBY(-oparg);
|
||||
#if ENABLE_SPECIALIZATION
|
||||
this_instr[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER);
|
||||
if (this_instr[1].cache > tstate->interp->optimizer_backedge_threshold &&
|
||||
|
@ -3346,6 +3352,7 @@
|
|||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(ENTER_EXECUTOR);
|
||||
TIER_ONE_ONLY
|
||||
CHECK_EVAL_BREAKER();
|
||||
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
|
@ -3890,6 +3897,7 @@
|
|||
PyObject *exit;
|
||||
PyObject *res;
|
||||
mgr = stack_pointer[-1];
|
||||
TIER_ONE_ONLY
|
||||
/* pop the context manager, push its __exit__ and the
|
||||
* value returned from calling its __enter__
|
||||
*/
|
||||
|
@ -5560,10 +5568,10 @@
|
|||
|
||||
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
|
||||
_Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
next_instr += 2;
|
||||
INSTRUCTION_STATS(INSTRUMENTED_JUMP_BACKWARD);
|
||||
CHECK_EVAL_BREAKER();
|
||||
INSTRUMENTED_JUMP(this_instr, next_instr + 1 - oparg, PY_MONITORING_EVENT_JUMP);
|
||||
INSTRUMENTED_JUMP(this_instr, next_instr - oparg, PY_MONITORING_EVENT_JUMP);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue