10000 GH-100982: Break up `COMPARE_AND_BRANCH` by brandtbucher · Pull Request #102801 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-100982: Break up COMPARE_AND_BRANCH #102801

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 15 commits into from
Mar 23, 2023
Prev Previous commit
Next Next commit
Catch up with main
  • Loading branch information
brandtbucher committed Feb 22, 2023
commit 39ace6485482bd73b26947f231c54e0183218da4
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode.h

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

5 changes: 3 additions & 2 deletions Include/opcode.h

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

13 changes: 0 additions & 13 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,19 +1117,6 @@ stack_effect(int opcode, int oparg, int jump)
case JUMP_NO_INTERRUPT:
return 0;

case JUMP_IF_TRUE_OR_POP:
case JUMP_IF_FALSE_OR_POP:
return jump ? 0 : -1;

case POP_JUMP_IF_NONE:
case POP_JUMP_IF_NOT_NONE:
case POP_JUMP_IF_FALSE:
case POP_JUMP_IF_TRUE:
return -1;

case LOAD_GLOBAL:
return (oparg & 1) + 1;

/* Exception handling pseudo-instructions */
case SETUP_FINALLY:
/* 0 in the normal flow.
Expand Down
2 changes: 1 addition & 1 deletion Python/opcode_targets.h

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

8 changes: 4 additions & 4 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1961,12 +1961,12 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
goto failure;
}
if (PyFloat_CheckExact(lhs)) {
_py_set_opcode(instr, COMPARE_OP_FLOAT);
instr->op.code = COMPARE_OP_FLOAT;
goto success;
}
if (PyLong_CheckExact(lhs)) {
if (Py_ABS(Py_SIZE(lhs)) <= 1 && Py_ABS(Py_SIZE(rhs)) <= 1) {
_py_set_opcode(instr, COMPARE_OP_INT);
instr->op.code = COMPARE_OP_INT;
goto success;
}
else {
Expand All @@ -1981,14 +1981,14 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
goto failure;
}
else {
_py_set_opcode(instr, COMPARE_OP_STR);
instr->op.code = COMPARE_OP_STR;
goto success;
}
}
SPECIALIZATION_FAIL(COMPARE_OP, compare_op_fail_kind(lhs, rhs));
failure:
STAT_INC(COMPARE_OP, failure);
_py_set_opcode(instr, COMPARE_OP);
instr->op.code = COMPARE_OP;
cache->counter = adaptive_counter_backoff(cache->counter);
return;
success:
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0