@@ -9,6 +9,7 @@ extern "C" {
99#endif
1010
1111#include "pycore_typedefs.h" // _PyInterpreterFrame
12+ #include "pycore_uop.h" // _PyUOpInstruction
1213#include "pycore_uop_ids.h"
1314#include "pycore_stackref.h" // _PyStackRef
1415#include <stdbool.h>
@@ -41,32 +42,6 @@ typedef struct {
4142 PyCodeObject * code ; // Weak (NULL if no corresponding ENTER_EXECUTOR).
4243} _PyVMData ;
4344
44- /* Depending on the format,
45- * the 32 bits between the oparg and operand are:
46- * UOP_FORMAT_TARGET:
47- * uint32_t target;
48- * UOP_FORMAT_JUMP
49- * uint16_t jump_target;
50- * uint16_t error_target;
51- */
52- typedef struct {
53- uint16_t opcode :15 ;
54- uint16_t format :1 ;
55- uint16_t oparg ;
56- union {
57- uint32_t target ;
58- struct {
59- uint16_t jump_target ;
60- uint16_t error_target ;
61- };
62- };
63- uint64_t operand0 ; // A cache entry
64- uint64_t operand1 ;
65- #ifdef Py_STATS
66- uint64_t execution_count ;
67- #endif
68- } _PyUOpInstruction ;
69-
7045typedef struct _PyExitData {
7146 uint32_t target ;
7247 uint16_t index ;
@@ -118,9 +93,6 @@ PyAPI_FUNC(void) _Py_Executors_InvalidateCold(PyInterpreterState *interp);
11893// trace_run_counter is greater than this value.
11994#define JIT_CLEANUP_THRESHOLD 100000
12095
121- // This is the length of the trace we project initially.
122- #define UOP_MAX_TRACE_LENGTH 1200
123-
12496#define TRACE_STACK_SIZE 5
12597
12698int _Py_uop_analyze_and_optimize (_PyInterpreterFrame * frame ,
@@ -278,9 +250,13 @@ PyJitRef_IsBorrowed(JitOptRef ref)
278250}
279251
280252struct _Py_UOpsAbstractFrame {
253+ bool globals_watched ;
254+ // The version number of the globals dicts, once checked. 0 if unchecked.
255+ uint32_t globals_checked_version ;
281256 // Max stacklen
282257 int stack_len ;
283258 int locals_len ;
259+ PyFunctionObject * func ;
284260
285261 JitOptRef * stack_pointer ;
286262 JitOptRef * stack ;
@@ -299,6 +275,8 @@ typedef struct _JitOptContext {
299275 char done ;
300276 char out_of_space ;
301277 bool contradiction ;
278+ // Has the builtins dict been watched?
279+ bool builtins_watched ;
302280 // The current "executing" frame.
303281 _Py_UOpsAbstractFrame * frame ;
304282 _Py_UOpsAbstractFrame frames [MAX_ABSTRACT_FRAME_DEPTH ];
0 commit comments