]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix naming of things
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Tue, 21 Oct 2025 20:30:07 +0000 (21:30 +0100)
committerKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Tue, 21 Oct 2025 20:30:07 +0000 (21:30 +0100)
15 files changed:
Include/internal/pycore_interp_structs.h
Include/internal/pycore_optimizer.h
Objects/codeobject.c
Objects/frameobject.c
Objects/funcobject.c
Python/bytecodes.c
Python/ceval.c
Python/ceval_macros.h
Python/executor_cases.c.h
Python/generated_cases.c.h
Python/generated_tracer_cases.c.h
Python/instrumentation.c
Python/optimizer.c
Python/pystate.c
Tools/cases_generator/analyzer.py

index 5285233b6b13425a7750969ba37cf94ac92ef43f..ac1bcdf74ae417270bec659cccd6a05c5392e467 100644 (file)
@@ -758,20 +758,20 @@ struct _Py_unique_id_pool {
 typedef _Py_CODEUNIT *(*_PyJitEntryFuncPtr)(struct _PyExecutorObject *exec, _PyInterpreterFrame *frame, _PyStackRef *stack_pointer, PyThreadState *tstate);
 
 typedef struct _PyJitTracerState {
-    int jit_tracer_code_max_size;
-    int jit_tracer_code_curr_size;
-    _PyBloomFilter jit_tracer_dependencies;
-    bool jit_tracer_dependencies_still_valid;
-    _PyUOpInstruction *jit_tracer_code_buffer;
-    _Py_CODEUNIT *jit_tracer_insert_exec_instr;
-    _Py_CODEUNIT *jit_tracer_close_loop_instr;
+    bool dependencies_still_valid;
+    int code_max_size;
+    int code_curr_size;
+    int initial_stack_depth;
+    int initial_chain_depth;
+    _PyUOpInstruction *code_buffer;
+    _Py_CODEUNIT *insert_exec_instr;
+    _Py_CODEUNIT *close_loop_instr;
     _Py_CODEUNIT *last_specialized_instr;
-    int jit_tracer_initial_stack_depth;
-    int jit_tracer_initial_chain_depth;
-    PyCodeObject *jit_tracer_initial_code; // Strong
-    PyFunctionObject *jit_tracer_initial_func; // Strong
-    struct _PyExitData *jit_tracer_previous_exit;
-    _PyInterpreterFrame *jit_tracer_current_frame;
+    PyCodeObject *initial_code; // Strong
+    PyFunctionObject *initial_func; // Strong
+    struct _PyExitData *previous_exit;
+    _PyInterpreterFrame *current_frame;
+    _PyBloomFilter dependencies;
 } _PyJitTracerState;
 
 /* PyInterpreterState holds the global state for one of the runtime's
index 0acf1940276966465182dd39e88a8e7ac5f297d1..a87cce85e9798b1eee1931f8e84025d22ad2a583 100644 (file)
@@ -359,7 +359,7 @@ extern void _Py_ClearExecutorDeletionList(PyInterpreterState *interp);
 #endif
 
 int
-_PyJIT_translate_single_bytecode_to_trace(
+_PyJit_translate_single_bytecode_to_trace(
     PyThreadState *tstate,
     _PyInterpreterFrame *frame,
     _Py_CODEUNIT *this_instr,
@@ -372,11 +372,12 @@ _PyJIT_translate_single_bytecode_to_trace(
     int jump_taken);
 
 void
-_PyJIT_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr, _Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit);
+_PyJit_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr
+    _Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit);
 
-void _PyJIT_FinalizeTracing(PyThreadState *tstate);
+void _PyJit_FinalizeTracing(PyThreadState *tstate);
 
-void _Py_JITTracer_InvalidateDependency(PyThreadState *old_tstate, void *obj);
+void _PyJit_Tracer_InvalidateDependency(PyThreadState *old_tstate, void *obj);
 
 #ifdef __cplusplus
 }
index d0dd65300a1d8e319fa06e95e1a8dac64a010e5b..3a13cfaee2a5fca978e7eb564ec16234c36b2bab 100644 (file)
@@ -2415,7 +2415,7 @@ code_dealloc(PyObject *self)
         PyMem_Free(co_extra);
     }
 #ifdef _Py_TIER2
-    _Py_JITTracer_InvalidateDependency(tstate, self);
+    _PyJit_Tracer_InvalidateDependency(tstate, self);
     if (co->co_executors != NULL) {
         clear_executors(co);
     }
index 156daef7f9c6ad1ade4dbb3a1c0a95364e4e0a8c..abed4547ffd05368ac1e7faff953240d2a61cc05 100644 (file)
@@ -264,7 +264,7 @@ framelocalsproxy_setitem(PyObject *self, PyObject *key, PyObject *value)
 
 #if _Py_TIER2
         _Py_Executors_InvalidateDependency(PyInterpreterState_Get(), co, 1);
-        _Py_JITTracer_InvalidateDependency(PyThreadState_GET(), co);
+        _PyJit_Tracer_InvalidateDependency(PyThreadState_GET(), co);
 #endif
 
         _PyLocals_Kind kind = _PyLocals_GetKind(co->co_localspluskinds, i);
index 5a801b616fef17903b5adf0d97781cbff5f22342..fcd79c7e4f4ea1d58ac2464a3cf9b2ee2f43dfb4 100644 (file)
@@ -11,7 +11,7 @@
 #include "pycore_setobject.h"     // _PySet_NextEntry()
 #include "pycore_stats.h"
 #include "pycore_weakref.h"       // FT_CLEAR_WEAKREFS()
-#include "pycore_optimizer.h"     // _Py_JITTracer_InvalidateDependency
+#include "pycore_optimizer.h"     // _PyJit_Tracer_InvalidateDependency
 
 static const char *
 func_event_name(PyFunction_WatchEvent event) {
@@ -1152,7 +1152,7 @@ func_dealloc(PyObject *self)
         return;
     }
 #if _Py_TIER2
-    _Py_JITTracer_InvalidateDependency(PyThreadState_GET(), self);
+    _PyJit_Tracer_InvalidateDependency(PyThreadState_GET(), self);
 #endif
     _PyObject_GC_UNTRACK(op);
     FT_CLEAR_WEAKREFS(self, op->func_weakreflist);
index ab5649281d90258a3cc9993f2421bc94e8a40874..f8742e6212d795c14e74e06ac16b8fa178e2d67f 100644 (file)
@@ -2970,9 +2970,9 @@ dummy_func(
             if (!IS_JIT_TRACING() && backoff_counter_triggers(counter) &&
                 this_instr->op.code == JUMP_BACKWARD_JIT &&
                 next_instr->op.code != ENTER_EXECUTOR) {
-                if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
-                    tstate->interp->jit_state.jit_tracer_code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
-                    if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
+                if (tstate->interp->jit_state.code_buffer == NULL) {
+                    tstate->interp->jit_state.code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
+                    if (tstate->interp->jit_state.code_buffer == NULL) {
                         // Don't error, just go to next instruction.
                         DISPATCH();
                     }
@@ -2985,7 +2985,7 @@ dummy_func(
                         oparg >>= 8;
                         insert_exec_at--;
                     }
-                    _PyJIT_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
+                    _PyJit_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
                     ENTER_TRACING();
                 }
                 int _jump_taken = false;
@@ -5456,7 +5456,7 @@ dummy_func(
                 _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit);
                 assert(tstate->current_executor == (PyObject *)previous_executor);
                 int chain_depth = previous_executor->vm_data.chain_depth + 1;
-                _PyJIT_InitializeTracing(tstate, frame, target, target, STACK_LEVEL(), chain_depth, exit);
+                _PyJit_InitializeTracing(tstate, frame, target, target, STACK_LEVEL(), chain_depth, exit);
                 exit->temperature = initial_temperature_backoff_counter();
                 GOTO_TIER_ONE(target, 1);
             }
index 08add3f75cd5297a6328f6f18b002655860690b5..e8f1ed5f88b28dda1610f7f2aec91a6e9c63d47b 100644 (file)
@@ -990,8 +990,8 @@ static inline int
 add_to_code_trace(PyThreadState *tstate, _PyInterpreterFrame *frame, PyCodeObject *old_code, PyFunctionObject *old_func, int old_stack_level, _Py_CODEUNIT *this_instr, _Py_CODEUNIT *next_instr, int opcode, int oparg, int jump_taken)
 {
     assert(frame != NULL);
-    assert(tstate->interp->jit_state.jit_tracer_code_curr_size < UOP_MAX_TRACE_LENGTH);
-    return !_PyJIT_translate_single_bytecode_to_trace(tstate, frame, this_instr, next_instr, old_code, old_func, old_stack_level, opcode, oparg, jump_taken);
+    assert(tstate->interp->jit_state.code_curr_size < UOP_MAX_TRACE_LENGTH);
+    return !_PyJit_translate_single_bytecode_to_trace(tstate, frame, this_instr, next_instr, old_code, old_func, old_stack_level, opcode, oparg, jump_taken);
 }
 #endif
 
index e85adf88c679af851f19a10f28f0b34ad8d51d28..1d359461ffa0678ac84137405c28a07a4af22bea 100644 (file)
         if (!_PyErr_Occurred(tstate) && !_is_sys_tracing) { \
             _PyFrame_SetStackPointer(frame, stack_pointer); \
             int _err = _PyOptimizer_Optimize(frame, tstate); \
-            _PyJIT_FinalizeTracing(tstate); \
+            _PyJit_FinalizeTracing(tstate); \
             stack_pointer = _PyFrame_GetStackPointer(frame); \
             if (_err < 0) { \
                 JUMP_TO_LABEL(error); \
         } \
         else { \
             _PyFrame_SetStackPointer(frame, stack_pointer); \
-            _PyJIT_FinalizeTracing(tstate); \
+            _PyJit_FinalizeTracing(tstate); \
             stack_pointer = _PyFrame_GetStackPointer(frame); \
         } \
     } while (0);
@@ -451,7 +451,7 @@ do {                                                   \
     }                                                  \
     if (keep_tracing_bit) { \
         assert(next_instr->op.code != ENTER_EXECUTOR); \
-        assert(tstate->interp->jit_state.jit_tracer_code_curr_size == 2); \
+        assert(tstate->interp->jit_state.code_curr_size == 2); \
         ENTER_TRACING(); \
     } \
     DISPATCH();                                        \
index 7e76e0a0719e7f78167689cba23a907a138b4607..72927d8378c3bdf840c197cd546dee99830872f2 100644 (file)
                 _PyExecutorObject *previous_executor = _PyExecutor_FromExit(exit);
                 assert(tstate->current_executor == (PyObject *)previous_executor);
                 int chain_depth = previous_executor->vm_data.chain_depth + 1;
-                _PyJIT_InitializeTracing(tstate, frame, target, target, STACK_LEVEL(), chain_depth, exit);
+                _PyJit_InitializeTracing(tstate, frame, target, target, STACK_LEVEL(), chain_depth, exit);
                 exit->temperature = initial_temperature_backoff_counter();
                 GOTO_TIER_ONE(target, 1);
             }
index 0aeff340806f17b05abef47f960e658f78b1e7f7..4fb61a06cdfe049aa36195122a32fd164a9f8362 100644 (file)
                 if (!IS_JIT_TRACING() && backoff_counter_triggers(counter) &&
                     this_instr->op.code == JUMP_BACKWARD_JIT &&
                     next_instr->op.code != ENTER_EXECUTOR) {
-                    if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
+                    if (tstate->interp->jit_state.code_buffer == NULL) {
                         _PyFrame_SetStackPointer(frame, stack_pointer);
-                        tstate->interp->jit_state.jit_tracer_code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
+                        tstate->interp->jit_state.code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
                         stack_pointer = _PyFrame_GetStackPointer(frame);
-                        if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
+                        if (tstate->interp->jit_state.code_buffer == NULL) {
                             DISPATCH();
                         }
                     }
                             oparg >>= 8;
                             insert_exec_at--;
                         }
-                        _PyJIT_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
+                        _PyJit_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
                         ENTER_TRACING();
                     }
                     int _jump_taken = false;
index 123315df9e5ffe4e2bd489be142339f8a6f79ec8..6317b02ddb9343bcd066cbb5bb9f8d0ee58251f3 100644 (file)
                 if (!IS_JIT_TRACING() && backoff_counter_triggers(counter) &&
                     this_instr->op.code == JUMP_BACKWARD_JIT &&
                     next_instr->op.code != ENTER_EXECUTOR) {
-                    if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
+                    if (tstate->interp->jit_state.code_buffer == NULL) {
                         _PyFrame_SetStackPointer(frame, stack_pointer);
-                        tstate->interp->jit_state.jit_tracer_code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
+                        tstate->interp->jit_state.code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
                         stack_pointer = _PyFrame_GetStackPointer(frame);
-                        if (tstate->interp->jit_state.jit_tracer_code_buffer == NULL) {
+                        if (tstate->interp->jit_state.code_buffer == NULL) {
                             TRACING_DISPATCH();
                         }
                     }
                             oparg >>= 8;
                             insert_exec_at--;
                         }
-                        _PyJIT_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
+                        _PyJit_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
                         ENTER_TRACING();
                     }
                     int _jump_taken = false;
index 85fb73aaf098ee2e973c4ed64b4e251e0bf9b7c9..81e46a331e0b9e0d0b8d2a8afc0f3e7cdbc3c539 100644 (file)
@@ -1786,7 +1786,7 @@ force_instrument_lock_held(PyCodeObject *code, PyInterpreterState *interp)
         _PyCode_Clear_Executors(code);
     }
     _Py_Executors_InvalidateDependency(interp, code, 1);
-    _Py_JITTracer_InvalidateDependency(PyThreadState_GET(), code);
+    _PyJit_Tracer_InvalidateDependency(PyThreadState_GET(), code);
 #endif
     int code_len = (int)Py_SIZE(code);
     /* Exit early to avoid creating instrumentation
index c7967d09093666131c82b689b7688b6a94d9caf2..8482162d4a325c6266534c0e83dfa56c7877d526 100644 (file)
@@ -118,10 +118,10 @@ _PyOptimizer_Optimize(
     _PyInterpreterFrame *frame, PyThreadState *tstate)
 {
     PyInterpreterState *interp = _PyInterpreterState_GET();
-    int chain_depth = tstate->interp->jit_state.jit_tracer_initial_chain_depth;
+    int chain_depth = tstate->interp->jit_state.initial_chain_depth;
     assert(interp->jit);
     assert(!interp->compiling);
-    assert(tstate->interp->jit_state.jit_tracer_initial_stack_depth >= 0);
+    assert(tstate->interp->jit_state.initial_stack_depth >= 0);
 #ifndef Py_GIL_DISABLED
     interp->compiling = true;
     // The first executor in a chain and the MAX_CHAIN_DEPTH'th executor *must*
@@ -130,8 +130,8 @@ _PyOptimizer_Optimize(
     // this is true, since a deopt won't infinitely re-enter the executor:
     chain_depth %= MAX_CHAIN_DEPTH;
     bool progress_needed = chain_depth == 0;
-    PyCodeObject *code = (PyCodeObject *)tstate->interp->jit_state.jit_tracer_initial_code;
-    _Py_CODEUNIT *start = tstate->interp->jit_state.jit_tracer_insert_exec_instr;
+    PyCodeObject *code = (PyCodeObject *)tstate->interp->jit_state.initial_code;
+    _Py_CODEUNIT *start = tstate->interp->jit_state.insert_exec_instr;
     // A recursive trace might've cleared the values. In that case, bail.
     if (code == NULL) {
         interp->compiling = false;
@@ -142,7 +142,7 @@ _PyOptimizer_Optimize(
         return 0;
     }
     // One of our dependencies while tracing was invalidated. Not worth compiling.
-    if (!tstate->interp->jit_state.jit_tracer_dependencies_still_valid) {
+    if (!tstate->interp->jit_state.dependencies_still_valid) {
         interp->compiling = false;
         return 0;
     }
@@ -172,7 +172,7 @@ _PyOptimizer_Optimize(
         executor->vm_data.code = NULL;
     }
     if (chain_depth > 0) {
-        _PyExitData *prev_exit = tstate->interp->jit_state.jit_tracer_previous_exit;
+        _PyExitData *prev_exit = tstate->interp->jit_state.previous_exit;
         assert(prev_exit != NULL);
         prev_exit->executor = executor;;
     }
@@ -551,7 +551,7 @@ add_to_trace(
 /* Returns 1 on success (added to trace), 0 on trace end.
  */
 int
-_PyJIT_translate_single_bytecode_to_trace(
+_PyJit_translate_single_bytecode_to_trace(
     PyThreadState *tstate,
     _PyInterpreterFrame *frame,
     _Py_CODEUNIT *this_instr,
@@ -564,13 +564,13 @@ _PyJIT_translate_single_bytecode_to_trace(
     int jump_taken)
 {
 
-    int is_first_instr = tstate->interp->jit_state.jit_tracer_close_loop_instr == this_instr;
-    bool progress_needed = (tstate->interp->jit_state.jit_tracer_initial_chain_depth % MAX_CHAIN_DEPTH) == 0;;
-    _PyBloomFilter *dependencies = &tstate->interp->jit_state.jit_tracer_dependencies;
+    int is_first_instr = tstate->interp->jit_state.close_loop_instr == this_instr;
+    bool progress_needed = (tstate->interp->jit_state.initial_chain_depth % MAX_CHAIN_DEPTH) == 0;;
+    _PyBloomFilter *dependencies = &tstate->interp->jit_state.dependencies;
     _Py_BloomFilter_Add(dependencies, old_code);
-    int trace_length = tstate->interp->jit_state.jit_tracer_code_curr_size;
-    _PyUOpInstruction *trace = tstate->interp->jit_state.jit_tracer_code_buffer;
-    int max_length = tstate->interp->jit_state.jit_tracer_code_max_size;
+    int trace_length = tstate->interp->jit_state.code_curr_size;
+    _PyUOpInstruction *trace = tstate->interp->jit_state.code_buffer;
+    int max_length = tstate->interp->jit_state.code_max_size;
 
 #ifdef Py_DEBUG
     char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
@@ -597,7 +597,7 @@ _PyJIT_translate_single_bytecode_to_trace(
     }
 #endif
 
-    if (!tstate->interp->jit_state.jit_tracer_dependencies_still_valid) {
+    if (!tstate->interp->jit_state.dependencies_still_valid) {
         goto done;
     }
 
@@ -609,7 +609,7 @@ _PyJIT_translate_single_bytecode_to_trace(
     if (jump_taken ||
         // This happens when a recursive call happens that we can't trace. Such as Python -> C -> Python calls
         // If we haven't guarded the IP, then it's untraceable.
-        (frame != tstate->interp->jit_state.jit_tracer_current_frame && !needs_guard_ip) ||
+        (frame != tstate->interp->jit_state.current_frame && !needs_guard_ip) ||
         (oparg > 0xFFFF) ||
         // TODO (gh-140277): The constituent use one extra stack slot. So we need to check for headroom.
         (opcode == BINARY_OP_SUBSCR_GETITEM && old_stack_level + 1 > old_code->co_stacksize)||
@@ -638,7 +638,7 @@ _PyJIT_translate_single_bytecode_to_trace(
                 }
         }
 
-    tstate->interp->jit_state.jit_tracer_current_frame = frame;
+    tstate->interp->jit_state.current_frame = frame;
 
     if (opcode == NOP) {
         return 1;
@@ -672,7 +672,7 @@ _PyJIT_translate_single_bytecode_to_trace(
 
     /* Special case the first instruction,
      * so that we can guarantee forward progress */
-    if (progress_needed && tstate->interp->jit_state.jit_tracer_code_curr_size <= 2) {
+    if (progress_needed && tstate->interp->jit_state.code_curr_size <= 2) {
         if (OPCODE_HAS_EXIT(opcode) || OPCODE_HAS_DEOPT(opcode)) {
             opcode = _PyOpcode_Deopt[opcode];
         }
@@ -681,7 +681,7 @@ _PyJIT_translate_single_bytecode_to_trace(
     }
 
     // Loop back to the start
-    if (is_first_instr && tstate->interp->jit_state.jit_tracer_code_curr_size > 5) {
+    if (is_first_instr && tstate->interp->jit_state.code_curr_size > 5) {
         ADD_TO_TRACE(_JUMP_TO_TOP, 0, 0, 0);
         goto done;
     }
@@ -849,29 +849,29 @@ _PyJIT_translate_single_bytecode_to_trace(
     if (needs_guard_ip) {
         ADD_TO_TRACE(_GUARD_IP, 0, (uintptr_t)next_instr, 0);
     }
-    tstate->interp->jit_state.jit_tracer_code_curr_size = trace_length;
-    tstate->interp->jit_state.jit_tracer_code_max_size = max_length;
+    tstate->interp->jit_state.code_curr_size = trace_length;
+    tstate->interp->jit_state.code_max_size = max_length;
     return 1;
 done:
-    tstate->interp->jit_state.jit_tracer_code_curr_size = trace_length;
-    tstate->interp->jit_state.jit_tracer_code_max_size = max_length;
+    tstate->interp->jit_state.code_curr_size = trace_length;
+    tstate->interp->jit_state.code_max_size = max_length;
     return 0;
 full:
-    if (!is_terminator(&tstate->interp->jit_state.jit_tracer_code_buffer[trace_length-1])) {
+    if (!is_terminator(&tstate->interp->jit_state.code_buffer[trace_length-1])) {
         // Undo the last few instructions.
-        trace_length = tstate->interp->jit_state.jit_tracer_code_curr_size;
-        max_length = tstate->interp->jit_state.jit_tracer_code_max_size;
+        trace_length = tstate->interp->jit_state.code_curr_size;
+        max_length = tstate->interp->jit_state.code_max_size;
         // We previously reversed one.
         max_length += 1;
         ADD_TO_TRACE(_EXIT_TRACE, 0, 0, target);
     }
-    tstate->interp->jit_state.jit_tracer_code_curr_size = trace_length;
-    tstate->interp->jit_state.jit_tracer_code_max_size = max_length;
+    tstate->interp->jit_state.code_curr_size = trace_length;
+    tstate->interp->jit_state.code_max_size = max_length;
     return 0;
 }
 
 void
-_PyJIT_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr, _Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit)
+_PyJit_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *insert_exec_instr, _Py_CODEUNIT *close_loop_instr, int curr_stackdepth, int chain_depth, _PyExitData *exit)
 {
     PyCodeObject *code = _PyFrame_GetCode(frame);
 #ifdef Py_DEBUG
@@ -888,30 +888,30 @@ _PyJIT_InitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_
         2 * INSTR_IP(close_loop_instr, code),
         chain_depth);
 #endif
-    add_to_trace(tstate->interp->jit_state.jit_tracer_code_buffer, 0, _START_EXECUTOR, 0, (uintptr_t)insert_exec_instr, INSTR_IP(insert_exec_instr, code));
-    add_to_trace(tstate->interp->jit_state.jit_tracer_code_buffer, 1, _MAKE_WARM, 0, 0, 0);
-    tstate->interp->jit_state.jit_tracer_code_curr_size = 2;
-    tstate->interp->jit_state.jit_tracer_code_max_size = UOP_MAX_TRACE_LENGTH;
-    tstate->interp->jit_state.jit_tracer_insert_exec_instr = insert_exec_instr;
-    tstate->interp->jit_state.jit_tracer_close_loop_instr = close_loop_instr;
-    tstate->interp->jit_state.jit_tracer_initial_code = (PyCodeObject *)Py_NewRef(code);
-    tstate->interp->jit_state.jit_tracer_initial_func = (PyFunctionObject *)Py_NewRef(_PyFrame_GetFunction(frame));
-    tstate->interp->jit_state.jit_tracer_previous_exit = exit;
-    _Py_BloomFilter_Init(&tstate->interp->jit_state.jit_tracer_dependencies);
-    tstate->interp->jit_state.jit_tracer_initial_stack_depth = curr_stackdepth;
-    tstate->interp->jit_state.jit_tracer_initial_chain_depth = chain_depth % MAX_CHAIN_DEPTH;
-    tstate->interp->jit_state.jit_tracer_current_frame = frame;
-    tstate->interp->jit_state.jit_tracer_dependencies_still_valid = true;
+    add_to_trace(tstate->interp->jit_state.code_buffer, 0, _START_EXECUTOR, 0, (uintptr_t)insert_exec_instr, INSTR_IP(insert_exec_instr, code));
+    add_to_trace(tstate->interp->jit_state.code_buffer, 1, _MAKE_WARM, 0, 0, 0);
+    tstate->interp->jit_state.code_curr_size = 2;
+    tstate->interp->jit_state.code_max_size = UOP_MAX_TRACE_LENGTH;
+    tstate->interp->jit_state.insert_exec_instr = insert_exec_instr;
+    tstate->interp->jit_state.close_loop_instr = close_loop_instr;
+    tstate->interp->jit_state.initial_code = (PyCodeObject *)Py_NewRef(code);
+    tstate->interp->jit_state.initial_func = (PyFunctionObject *)Py_NewRef(_PyFrame_GetFunction(frame));
+    tstate->interp->jit_state.previous_exit = exit;
+    _Py_BloomFilter_Init(&tstate->interp->jit_state.dependencies);
+    tstate->interp->jit_state.initial_stack_depth = curr_stackdepth;
+    tstate->interp->jit_state.initial_chain_depth = chain_depth % MAX_CHAIN_DEPTH;
+    tstate->interp->jit_state.current_frame = frame;
+    tstate->interp->jit_state.dependencies_still_valid = true;
     tstate->interp->jit_state.last_specialized_instr = NULL;
 }
 
 void
-_PyJIT_FinalizeTracing(PyThreadState *tstate)
+_PyJit_FinalizeTracing(PyThreadState *tstate)
 {
-    Py_CLEAR(tstate->interp->jit_state.jit_tracer_initial_code);
-    Py_CLEAR(tstate->interp->jit_state.jit_tracer_initial_func);
-    tstate->interp->jit_state.jit_tracer_code_curr_size = 2;
-    tstate->interp->jit_state.jit_tracer_code_max_size = UOP_MAX_TRACE_LENGTH - 1;
+    Py_CLEAR(tstate->interp->jit_state.initial_code);
+    Py_CLEAR(tstate->interp->jit_state.initial_func);
+    tstate->interp->jit_state.code_curr_size = 2;
+    tstate->interp->jit_state.code_max_size = UOP_MAX_TRACE_LENGTH - 1;
 }
 
 
@@ -1215,17 +1215,17 @@ uop_optimize(
     _PyExecutorObject **exec_ptr,
     bool progress_needed)
 {
-    _PyBloomFilter *dependencies = &tstate->interp->jit_state.jit_tracer_dependencies;
+    _PyBloomFilter *dependencies = &tstate->interp->jit_state.dependencies;
     PyInterpreterState *interp = _PyInterpreterState_GET();
-    _PyUOpInstruction *buffer = interp->jit_state.jit_tracer_code_buffer;
+    _PyUOpInstruction *buffer = interp->jit_state.code_buffer;
     OPT_STAT_INC(attempts);
     char *env_var = Py_GETENV("PYTHON_UOPS_OPTIMIZE");
     bool is_noopt = true;
     if (env_var == NULL || *env_var == '\0' || *env_var > '0') {
         is_noopt = false;
     }
-    int curr_stackentries = tstate->interp->jit_state.jit_tracer_initial_stack_depth;
-    int length = interp->jit_state.jit_tracer_code_curr_size;
+    int curr_stackentries = tstate->interp->jit_state.initial_stack_depth;
+    int length = interp->jit_state.code_curr_size;
     // Trace too short, don't bother.
     if (length <= 5) {
         return 0;
@@ -1234,7 +1234,7 @@ uop_optimize(
     assert(length < UOP_MAX_TRACE_LENGTH);
     OPT_STAT_INC(traces_created);
     if (!is_noopt) {
-        length = _Py_uop_analyze_and_optimize(tstate->interp->jit_state.jit_tracer_initial_func, buffer,
+        length = _Py_uop_analyze_and_optimize(tstate->interp->jit_state.initial_func, buffer,
                                            length,
                                            curr_stackentries, dependencies);
         if (length <= 0) {
@@ -1259,7 +1259,7 @@ uop_optimize(
     OPT_HIST(effective_trace_length(buffer, length), optimized_trace_length_hist);
     length = prepare_for_execution(buffer, length);
     assert(length <= UOP_MAX_TRACE_LENGTH);
-    _PyExecutorObject *executor = make_executor_from_uops(buffer, length,  dependencies, tstate->interp->jit_state.jit_tracer_initial_chain_depth);
+    _PyExecutorObject *executor = make_executor_from_uops(buffer, length,  dependencies, tstate->interp->jit_state.initial_chain_depth);
     if (executor == NULL) {
         return -1;
     }
@@ -1555,15 +1555,15 @@ error:
 }
 
 void
-_Py_JITTracer_InvalidateDependency(PyThreadState *tstate, void *obj)
+_PyJit_Tracer_InvalidateDependency(PyThreadState *tstate, void *obj)
 {
     _PyBloomFilter obj_filter;
     _Py_BloomFilter_Init(&obj_filter);
     _Py_BloomFilter_Add(&obj_filter, obj);
 
-    if (bloom_filter_may_contain(&tstate->interp->jit_state.jit_tracer_dependencies, &obj_filter))
+    if (bloom_filter_may_contain(&tstate->interp->jit_state.dependencies, &obj_filter))
     {
-        tstate->interp->jit_state.jit_tracer_dependencies_still_valid = false;
+        tstate->interp->jit_state.dependencies_still_valid = false;
     }
 }
 /* Invalidate all executors */
index f0790322abd1ffc34abaeb06d34dd2d75fbc1a09..ebb37fc8400eb21276600bfd00f4ccc4555b06a7 100644 (file)
@@ -556,11 +556,11 @@ init_interpreter(PyInterpreterState *interp,
 #endif
 
 #ifdef _Py_TIER2
-    interp->jit_state.jit_tracer_code_buffer = NULL;
-    interp->jit_state.jit_tracer_initial_stack_depth = -1;
-    interp->jit_state.jit_tracer_initial_chain_depth = -1;
-    interp->jit_state.jit_tracer_initial_code = NULL;
-    interp->jit_state.jit_tracer_initial_func = NULL;
+    interp->jit_state.code_buffer = NULL;
+    interp->jit_state.initial_stack_depth = -1;
+    interp->jit_state.initial_chain_depth = -1;
+    interp->jit_state.initial_code = NULL;
+    interp->jit_state.initial_func = NULL;
 #endif
     llist_init(&interp->mem_free_queue.head);
     llist_init(&interp->asyncio_tasks_head);
@@ -811,9 +811,9 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
 
 #ifdef _Py_TIER2
     _Py_ClearExecutorDeletionList(interp);
-    if (interp->jit_state.jit_tracer_code_buffer != NULL) {
-        _PyObject_VirtualFree(interp->jit_state.jit_tracer_code_buffer, UOP_BUFFER_SIZE);
-        interp->jit_state.jit_tracer_code_buffer = NULL;
+    if (interp->jit_state.code_buffer != NULL) {
+        _PyObject_VirtualFree(interp->jit_state.code_buffer, UOP_BUFFER_SIZE);
+        interp->jit_state.code_buffer = NULL;
     }
 #endif
     _PyAST_Fini(interp);
index 720bb5f0ec61f54e449d4a02ac5a278b8df9e00f..7a5e8786f2a80440ff267437012a40fad648f171 100644 (file)
@@ -696,7 +696,7 @@ NON_ESCAPING_FUNCTIONS = (
     "PyStackRef_Unwrap",
     "_PyLong_CheckExactAndCompact",
     "_PyExecutor_FromExit",
-    "_PyJIT_InitializeTracing",
+    "_PyJit_InitializeTracing",
 )