Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-47120: make POP_JUMP_IF_TRUE/FALSE/NONE/NOT_NONE relative #32400

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 16 commits into from
Apr 11, 2022
Merged
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
separate forward/backward jump implementations
  • Loading branch information
iritkatriel committed Apr 8, 2022
commit 6c35aa003063e6973e345b73fabde5ab0808093a
73 changes: 53 additions & 20 deletions 73 Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -3941,61 +3941,70 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

TARGET(POP_JUMP_BACKWARD_IF_FALSE) {
PREDICTED(POP_JUMP_BACKWARD_IF_FALSE);
oparg = -oparg;
JUMP_TO_INSTRUCTION(POP_JUMP_FORWARD_IF_FALSE);
}

TARGET(POP_JUMP_FORWARD_IF_FALSE) {
PREDICTED(POP_JUMP_FORWARD_IF_FALSE);
PyObject *cond = POP();
int err;
if (Py_IsTrue(cond)) {
Py_DECREF(cond);
DISPATCH();
}
if (Py_IsFalse(cond)) {
Py_DECREF(cond);
JUMPBY(oparg);
JUMPBY(-oparg);
CHECK_EVAL_BREAKER();
DISPATCH();
}
err = PyObject_IsTrue(cond);
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
if (err > 0)
;
else if (err == 0) {
JUMPBY(oparg);
JUMPBY(-oparg);
CHECK_EVAL_BREAKER();
}
else
goto error;
DISPATCH();
}

TARGET(POP_JUMP_BACKWARD_IF_TRUE) {
PREDICTED(POP_JUMP_BACKWARD_IF_TRUE);
oparg = -oparg;
JUMP_TO_INSTRUCTION(POP_JUMP_FORWARD_IF_TRUE);
TARGET(POP_JUMP_FORWARD_IF_FALSE) {
PREDICTED(POP_JUMP_FORWARD_IF_FALSE);
PyObject *cond = POP();
if (Py_IsTrue(cond)) {
Py_DECREF(cond);
}
else if (Py_IsFalse(cond)) {
Py_DECREF(cond);
JUMPBY(oparg);
}
else {
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
if (err > 0)
;
else if (err == 0) {
JUMPBY(oparg);
}
else
goto error;
}
DISPATCH();
}

TARGET(POP_JUMP_FORWARD_IF_TRUE) {
PREDICTED(POP_JUMP_FORWARD_IF_TRUE);
TARGET(POP_JUMP_BACKWARD_IF_TRUE) {
PyObject *cond = POP();
int err;
if (Py_IsFalse(cond)) {
Py_DECREF(cond);
DISPATCH();
}
if (Py_IsTrue(cond)) {
Py_DECREF(cond);
JUMPBY(oparg);
JUMPBY(-oparg);
CHECK_EVAL_BREAKER();
DISPATCH();
}
err = PyObject_IsTrue(cond);
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
if (err > 0) {
JUMPBY(oparg);
JUMPBY(-oparg);
CHECK_EVAL_BREAKER();
}
else if (err == 0)
Expand All @@ -4005,6 +4014,30 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
DISPATCH();
}

TARGET(POP_JUMP_FORWARD_IF_TRUE) {
PyObject *cond = POP();
if (Py_IsFalse(cond)) {
Py_DECREF(cond);
}
else if (Py_IsTrue(cond)) {
Py_DECREF(cond);
JUMPBY(oparg);
}
else {
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
if (err > 0) {
JUMPBY(oparg);
CHECK_EVAL_BREAKER();
markshannon marked this conversation as resolved.
Show resolved Hide resolved
}
else if (err == 0)
;
else
goto error;
}
DISPATCH();
}

TARGET(POP_JUMP_BACKWARD_IF_NOT_NONE) {
PyObject *value = POP();
if (!Py_IsNone(value)) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.