mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
GH-118095: Allow a variant of RESUME_CHECK in tier 2 (GH-118286)
This commit is contained in:
parent
aa8f6d2708
commit
ab6eda0ee5
6 changed files with 189 additions and 103 deletions
|
@ -690,6 +690,12 @@ top: // Jump here after _PUSH_FRAME or likely branches
|
|||
break;
|
||||
}
|
||||
|
||||
case RESUME:
|
||||
/* Use a special tier 2 version of RESUME_CHECK to allow traces to
|
||||
* start with RESUME_CHECK */
|
||||
ADD_TO_TRACE(_TIER2_RESUME_CHECK, 0, 0, target);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
const struct opcode_macro_expansion *expansion = &_PyOpcode_macro_expansion[opcode];
|
||||
|
@ -967,7 +973,18 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
|
|||
int32_t target = (int32_t)uop_get_target(inst);
|
||||
if (_PyUop_Flags[opcode] & (HAS_EXIT_FLAG | HAS_DEOPT_FLAG)) {
|
||||
if (target != current_jump_target) {
|
||||
uint16_t exit_op = (_PyUop_Flags[opcode] & HAS_EXIT_FLAG) ? _SIDE_EXIT : _DEOPT;
|
||||
uint16_t exit_op;
|
||||
if (_PyUop_Flags[opcode] & HAS_EXIT_FLAG) {
|
||||
if (opcode == _TIER2_RESUME_CHECK) {
|
||||
exit_op = _EVAL_BREAKER_EXIT;
|
||||
}
|
||||
else {
|
||||
exit_op = _SIDE_EXIT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
exit_op = _DEOPT;
|
||||
}
|
||||
make_exit(&buffer[next_spare], exit_op, target);
|
||||
current_jump_target = target;
|
||||
current_jump = next_spare;
|
||||
|
@ -1075,6 +1092,7 @@ sanity_check(_PyExecutorObject *executor)
|
|||
CHECK(
|
||||
opcode == _DEOPT ||
|
||||
opcode == _SIDE_EXIT ||
|
||||
opcode == _EVAL_BREAKER_EXIT ||
|
||||
opcode == _ERROR_POP_N);
|
||||
if (opcode == _SIDE_EXIT) {
|
||||
CHECK(inst->format == UOP_FORMAT_EXIT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue