@@ -24,7 +24,7 @@ executed more than some threshold number of times (see
2424[ ` backoff_counter_triggers ` ] ( ../Include/internal/pycore_backoff.h ) ).
2525It then calls the function ` _PyJit_TryInitializeTracing ` in
2626[ ` Python/optimizer.c ` ] ( ../Python/optimizer.c ) , passing it the current
27- [ frame] ( frames.md ) , instruction pointer and interpreter state.
27+ [ frame] ( frames.md ) , instruction pointer and state.
2828The interpreter then switches into "tracing mode" via the macro
2929` ENTER_TRACING() ` . On platforms that support computed goto and tail-calling
3030interpreters, the dispatch table is swapped out, while other platforms that do
@@ -38,7 +38,8 @@ During tracing mode, after each interpreter instruction's `DISPATCH()`,
3838the interpreter jumps to the ` TRACE_RECORD ` instruction. This instruction
3939records the previous instruction executed and also any live values of the next
4040operation it may require. It then translates the previous instruction to
41- a sequence of micro-ops. To ensure that the adaptive interpreter instructions
41+ a sequence of micro-ops using ` _PyJit_translate_single_bytecode_to_trace ` .
42+ To ensure that the adaptive interpreter instructions
4243and cache entries are up-to-date, the trace recording interpreter always resets
4344the adaptive counters of adaptive instructions it sees.
4445This forces a re-specialization of any new instruction should an instruction
@@ -69,12 +70,7 @@ executor in `co_executors`.
6970
7071The micro-op (abbreviated ` uop ` to approximate ` μop ` ) optimizer is defined in
7172[ ` Python/optimizer.c ` ] ( ../Python/optimizer.c ) as ` _PyOptimizer_Optimize ` .
72- It translates an instruction trace into a sequence of micro-ops by replacing
73- each bytecode by an equivalent sequence of micro-ops (see
74- ` _PyOpcode_macro_expansion ` in
75- [ pycore_opcode_metadata.h] ( ../Include/internal/pycore_opcode_metadata.h )
76- which is generated from [ ` Python/bytecodes.c ` ] ( ../Python/bytecodes.c ) ).
77- The micro-op sequence is then optimized by
73+ It takes a micro-op sequence from the trace recorder and optimizes with
7874` _Py_uop_analyze_and_optimize ` in
7975[ ` Python/optimizer_analysis.c ` ] ( ../Python/optimizer_analysis.c )
8076and an instance of ` _PyUOpExecutor_Type ` is created to contain it.
0 commit comments