@@ -115,8 +115,10 @@ static inline uint16_t uop_get_error_target(const _PyUOpInstruction *inst)
115115
116116
117117#define REF_IS_BORROWED 1
118+ #define REF_IS_INVALID 2
119+ #define REF_TAG_BITS 3
118120
119- #define JIT_BITS_TO_PTR_MASKED (REF ) ((JitOptSymbol *)(((REF).bits) & (~REF_IS_BORROWED )))
121+ #define JIT_BITS_TO_PTR_MASKED (REF ) ((JitOptSymbol *)(((REF).bits) & (~REF_TAG_BITS )))
120122
121123static inline JitOptSymbol *
122124PyJitRef_Unwrap (JitOptRef ref )
@@ -133,6 +135,18 @@ PyJitRef_Wrap(JitOptSymbol *sym)
133135 return (JitOptRef ){.bits = (uintptr_t )sym };
134136}
135137
138+ static inline JitOptRef
139+ PyJitRef_WrapInvalid (void * ptr )
140+ {
141+ return (JitOptRef ){.bits = (uintptr_t )ptr | REF_IS_INVALID };
142+ }
143+
144+ static inline bool
145+ PyJitRef_IsInvalid (JitOptRef ref )
146+ {
147+ return (ref .bits & REF_IS_INVALID ) == REF_IS_INVALID ;
148+ }
149+
136150static inline JitOptRef
137151PyJitRef_StripReferenceInfo (JitOptRef ref )
138152{
@@ -225,15 +239,15 @@ PyAPI_FUNC(int) _PyDumpExecutors(FILE *out);
225239PyAPI_FUNC (void ) _Py_ClearExecutorDeletionList (PyInterpreterState * interp );
226240#endif
227241
228- int _PyJit_translate_single_bytecode_to_trace (PyThreadState * tstate , _PyInterpreterFrame * frame , _Py_CODEUNIT * next_instr , int stop_tracing_opcode );
242+ PyAPI_FUNC ( int ) _PyJit_translate_single_bytecode_to_trace (PyThreadState * tstate , _PyInterpreterFrame * frame , _Py_CODEUNIT * next_instr , int stop_tracing_opcode );
229243
230244PyAPI_FUNC (int )
231245_PyJit_TryInitializeTracing (PyThreadState * tstate , _PyInterpreterFrame * frame ,
232246 _Py_CODEUNIT * curr_instr , _Py_CODEUNIT * start_instr ,
233247 _Py_CODEUNIT * close_loop_instr , int curr_stackdepth , int chain_depth , _PyExitData * exit ,
234248 int oparg , _PyExecutorObject * current_executor );
235249
236- void _PyJit_FinalizeTracing (PyThreadState * tstate , int err );
250+ PyAPI_FUNC ( void ) _PyJit_FinalizeTracing (PyThreadState * tstate , int err );
237251void _PyJit_TracerFree (_PyThreadStateImpl * _tstate );
238252
239253void _PyJit_Tracer_InvalidateDependency (PyThreadState * old_tstate , void * obj );
0 commit comments