8000 gh-104584: Support most jumping instructions by gvanrossum · Pull Request #106393 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-104584: Support most jumping instructions #106393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make JUMP_BACKWARD[_NO_INTERRUPT] viable
This involves some subtle rearrangement of code in JUMP_BACKWARD.
  • Loading branch information
gvanrossum committed Jul 7, 2023
commit b886ca64cc8402538893474ca01bbf0995c702da
7 changes: 4 additions & 3 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2224,12 +2224,12 @@ dummy_func(

inst(JUMP_BACKWARD, (--)) {
CHECK_EVAL_BREAKER();
#if ENABLE_SPECIALIZATION
_Py_CODEUNIT *here = next_instr - 1;
assert(oparg <= INSTR_OFFSET());
JUMPBY(1-oparg);
#if ENABLE_SPECIALIZATION
here[1].cache += (1 << OPTIMIZER_BITS_IN_COUNTER);
if (here[1].cache > tstate->interp->optimizer_backedge_threshold) {
JUMPBY(1 - oparg);
OBJECT_STAT_INC(optimization_attempts);
frame = _PyOptimizer_BackEdge(frame, here, next_instr, stack_pointer);
if (frame == NULL) {
Expand All @@ -2241,6 +2241,7 @@ dummy_func(
goto resume_frame;
}
#endif /* ENABLE_SPECIALIZATION */
JUMP_POP_DISPATCH(1 - oparg, 0);
}

pseudo(JUMP) = {
Expand Down Expand Up @@ -2302,7 +2303,7 @@ dummy_func(
* generator or coroutine, so we deliberately do not check it here.
* (see bpo-30039).
*/
JUMPBY(-oparg);
JUMP_POP_DISPATCH(-oparg, 0);
}

inst(GET_LEN, (obj -- obj, len_o)) {
Expand Down
6 changes: 1 addition & 5 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -2800,11 +2800,7 @@ _PyUopExecute(_PyExecutorObject *executor, _PyInterpreterFrame *frame, PyObject
}

exit:
#ifdef LLTRACE
if (lltrace >= 2) {
fprintf(stderr, "Jumping!\n");
}
#endif
DPRINTF(2, "Jumping!\n");
_PyFrame_SetStackPointer(frame, stack_pointer);
Py_DECREF(self);
return frame;
Expand Down
Loading
0