Skip to content

Commit

Permalink
pythonGH-111485: Mark some instructions as TIER_ONE_ONLY (pythonGH-…
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher authored and aisk committed Feb 11, 2024
1 parent da4c84e commit e74152f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 139 deletions.
7 changes: 7 additions & 0 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ dummy_func(
// specializations, but there is no output.
// At the end we just skip over the STORE_FAST.
op(_BINARY_OP_INPLACE_ADD_UNICODE, (unused/1, left, right --)) {
TIER_ONE_ONLY
assert(next_instr->op.code == STORE_FAST);
PyObject **target_local = &GETLOCAL(next_instr->op.arg);
DEOPT_IF(*target_local != left);
Expand Down Expand Up @@ -786,6 +787,7 @@ dummy_func(
}

inst(INTERPRETER_EXIT, (retval --)) {
TIER_ONE_ONLY
assert(frame == &entry_frame);
assert(_PyFrame_IsIncomplete(frame));
/* Restore previous frame and return. */
Expand Down Expand Up @@ -1072,6 +1074,7 @@ dummy_func(
}

inst(YIELD_VALUE, (retval -- unused)) {
TIER_ONE_ONLY
// NOTE: It's important that YIELD_VALUE never raises an exception!
// The compiler treats any exception raised here as a failed close()
// or throw() call.
Expand Down Expand Up @@ -2297,6 +2300,7 @@ dummy_func(
}

inst(JUMP_FORWARD, (--)) {
TIER_ONE_ONLY
JUMPBY(oparg);
}

Expand Down Expand Up @@ -2402,6 +2406,7 @@ dummy_func(
macro(POP_JUMP_IF_NOT_NONE) = _IS_NONE + _POP_JUMP_IF_FALSE;

inst(JUMP_BACKWARD_NO_INTERRUPT, (--)) {
TIER_ONE_ONLY
/* This bytecode is used in the `yield from` or `await` loop.
* If there is an interrupt, we want it handled in the innermost
* generator or coroutine, so we deliberately do not check it here.
Expand Down Expand Up @@ -3454,6 +3459,7 @@ dummy_func(

// This is secretly a super-instruction
inst(CALL_LIST_APPEND, (unused/1, unused/2, callable, self, args[oparg] -- unused)) {
TIER_ONE_ONLY
assert(oparg == 1);
PyInterpreterState *interp = tstate->interp;
DEOPT_IF(callable != interp->callable_cache.list_append);
Expand Down Expand Up @@ -3792,6 +3798,7 @@ dummy_func(
}

inst(RETURN_GENERATOR, (--)) {
TIER_ONE_ONLY
assert(PyFunction_Check(frame->f_funcobj));
PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj;
PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func);
Expand Down
139 changes: 0 additions & 139 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e74152f

Please sign in to comment.