@@ -13,8 +13,9 @@ enables optimizations that span multiple instructions.
1313The program begins running in tier 1, until a ` JUMP_BACKWARD ` instruction
1414determines that it is ` hot ` because the counter in its
1515[ inline cache] ( interpreter.md#inline-cache-entries ) indicates that is
16- executed more than some threshold number of times. It then calls the
17- function ` _PyOptimizer_Optimize() ` in
16+ executed more than some threshold number of times (see
17+ [ ` backoff_counter_triggers ` ] ( ../Include/internal/pycore_backoff.h ) ).
18+ It then calls the function ` _PyOptimizer_Optimize() ` in
1819[ ` Python/optimizer.c ` ] ( ../Python/optimizer.c ) , passing it the current
1920[ frame] ( frames.md ) and instruction pointer. ` _PyOptimizer_Optimize() `
2021constructs an object of type
@@ -46,17 +47,23 @@ each bytecode by an equivalent sequence of micro-ops
4647which is generated from [ ` Python/bytecodes.c ` ] ( ../Python/bytecodes.c ) ).
4748The micro-op sequence is then optimized by
4849` _Py_uop_analyze_and_optimize ` in
49- [ ` Python/optimizer_analysis.c ` ] ( ../Python/optimizer_analysis.c ) .
50+ [ ` Python/optimizer_analysis.c ` ] ( ../Python/optimizer_analysis.c )
51+ and a ` _PyUOpExecutor_Type ` is created to contain it.
5052
51- ## Running a uop executor
53+ ## Running a uop executor on the tier 2 interpreter
5254
5355After a tier 1 ` JUMP_BACKWARD ` instruction invokes the uop optimizer
5456to create a tier 2 uop executor, it transfers control to this executor
55- via the ` GOTO_TIER_TWO ` macro, which jumps to ` tier2_dispatch: ` in
56- [ ` Python/ceval.c ` ] ( ../Python/ceval.c ) , where there is a loops that
57+ via the ` GOTO_TIER_TWO ` macro.
58+
59+ When tier 2 is enabled but the JIT is not (python was configured with
60+ [ ` --enable-experimental-jit=interpreter ` ] ( https://docs.python.org/dev/using/configure.html#cmdoption-enable-experimental-jit ) ),
61+ the executor jumps to ` tier2_dispatch: ` in
62+ [ ` Python/ceval.c ` ] ( ../Python/ceval.c ) , where there is a loop that
5763executes the micro-ops which are defined in
5864[ ` Python/executor_cases.c.h ` ] ( ../Python/executor_cases.c.h ) .
59- This loop exits when an ` _EXIT_TRACE ` or ` _DEOPT ` uop is reached.
65+ This loop exits when an ` _EXIT_TRACE ` or ` _DEOPT ` uop is reached,
66+ and execution returns to teh tier 1 interpreter.
6067
6168## Invalidating Executors
6269
0 commit comments