Skip to content

Commit e909a83

Browse files
committed
Hacky way to make _FOR_ITER a viable uop
1 parent f965c81 commit e909a83

File tree

5 files changed

+73
-2
lines changed

5 files changed

+73
-2
lines changed

Include/internal/pycore_opcode_metadata.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/abstract_interp_cases.c.h

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -2368,7 +2368,7 @@ dummy_func(
23682368
goto enter_tier_one;
23692369
}
23702370

2371-
replaced op(_POP_JUMP_IF_FALSE, (unused/1, cond -- )) {
2371+
replaced op(_POP_JUMP_IF_FALSE, (unused/1, cond -- )) {
23722372
assert(PyBool_Check(cond));
23732373
int flag = Py_IsFalse(cond);
23742374
#if ENABLE_SPECIALIZATION
@@ -2520,10 +2520,13 @@ dummy_func(
25202520
if (!_PyErr_ExceptionMatches(tstate, PyExc_StopIteration)) {
25212521
GOTO_ERROR(error);
25222522
}
2523+
#if TIER_ONE
25232524
monitor_raise(tstate, frame, this_instr);
2525+
#endif
25242526
_PyErr_Clear(tstate);
25252527
}
25262528
/* iterator ended normally */
2529+
#if TIER_ONE
25272530
assert(next_instr[oparg].op.code == END_FOR ||
25282531
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
25292532
Py_DECREF(iter);
@@ -2532,6 +2535,7 @@ dummy_func(
25322535
JUMPBY(oparg + 1);
25332536
DISPATCH();
25342537
<<<<<<< HEAD
2538+
<<<<<<< HEAD
25352539
||||||| parent of 7dc8c93549a (Tiny fixes to code generator)
25362540
#endif
25372541
#if TIER_TWO
@@ -2565,6 +2569,14 @@ dummy_func(
25652569
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
25662570
goto enter_tier_one;
25672571
>>>>>>> 7dc8c93549a (Tiny fixes to code generator)
2572+
||||||| parent of 2bd857acb57 (Hacky way to make _FOR_ITER a viable uop)
2573+
=======
2574+
#endif
2575+
#if TIER_TWO
2576+
frame->instr_ptr = _PyCode_CODE(_PyFrame_GetCode(frame)) + oparg;
2577+
DEOPT_IF(true);
2578+
#endif
2579+
>>>>>>> 2bd857acb57 (Hacky way to make _FOR_ITER a viable uop)
25682580
}
25692581
// Common case: no jump, leave it to the code generator
25702582
}

Python/executor_cases.c.h

+49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)