8000 GH-111848: Set the IP when de-optimizing by markshannon · Pull Request #112065 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-111848: Set the IP when de-optimizing #112065

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

Merged
merged 14 commits into from
Nov 15, 2023
Merged
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
Next Next commit
Replace jumps with deopts in tier 2
  • Loading branch information
markshannon committed Nov 5, 2023
commit 317db3a6760c785d931174e81dfe0179f5b4d9c1
140 changes: 86 additions & 54 deletions Include/internal/pycore_opcode_metadata.h

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

14 changes: 12 additions & 2 deletions Python/abstract_interp_cases.c.h

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

32 changes: 20 additions & 12 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ dummy_func(
goto enter_tier_one;
}

inst(POP_JUMP_IF_FALSE, (unused/1, cond -- )) {
replaced op(_POP_JUMP_IF_FALSE, (unused/1, cond -- )) {
assert(PyBool_Check(cond));
int flag = Py_IsFalse(cond);
#if ENABLE_SPECIALIZATION
Expand All @@ -2393,7 +2393,7 @@ dummy_func(
JUMPBY(oparg * flag);
}

inst(POP_JUMP_IF_TRUE, (unused/1, cond -- )) {
replaced op(_POP_JUMP_IF_TRUE, (unused/1, cond -- )) {
assert(PyBool_Check(cond));
int flag = Py_IsTrue(cond);
#if ENABLE_SPECIALIZATION
Expand All @@ -2412,9 +2412,13 @@ dummy_func(
}
}

macro(POP_JUMP_IF_NONE) = _IS_NONE + POP_JUMP_IF_TRUE;
macro(POP_JUMP_IF_TRUE) = _POP_JUMP_IF_TRUE;

macro(POP_JUMP_IF_NOT_NONE) = _IS_NONE + POP_JUMP_IF_FALSE;
macro(POP_JUMP_IF_FALSE) = _POP_JUMP_IF_FALSE;

macro(POP_JUMP_IF_NONE) = _IS_NONE + _POP_JUMP_IF_TRUE;

macro(POP_JUMP_IF_NOT_NONE) = _IS_NONE + _POP_JUMP_IF_FALSE;

inst(JUMP_BACKWARD_NO_INTERRUPT, (--)) {
/* This bytecode is used in the `yield from` or `await` loop.
Expand Down Expand Up @@ -3979,16 +3983,20 @@ dummy_func(

///////// Tier-2 only opcodes /////////

op(_POP_JUMP_IF_FALSE, (flag -- )) {
if (Py_IsFalse(flag)) {
next_uop = current_executor->trace + oparg;
}
op (_GUARD_IS_TRUE_POP, (flag -- )) {
DEOPT_IF(Py_IsFalse(flag));
}

op(_POP_JUMP_IF_TRUE, (flag -- )) {
if (Py_IsTrue(flag)) {
next_uop = current_executor->trace + oparg;
}
op (_GUARD_IS_FALSE_POP, (flag -- )) {
DEOPT_IF(Py_IsTrue(flag));
}

op (_GUARD_IS_NONE_POP, (val -- )) {
DEOPT_IF(!Py_IsNone(val));
}

op (_GUARD_IS_NOT_NONE_POP, (val -- )) {
DEOPT_IF(Py_IsNone(val));
}

op(_JUMP_TO_TOP, (--)) {
Expand Down
28 changes: 20 additions & 8 deletions Python/executor_cases.c.h

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

Loading
0