diff --git a/Include/internal/pycore_tstate.h b/Include/internal/pycore_tstate.h index f1d8c4ba0d04e55..70c8b9159d8f421 100644 --- a/Include/internal/pycore_tstate.h +++ b/Include/internal/pycore_tstate.h @@ -102,7 +102,7 @@ typedef struct _PyThreadStateImpl { #if defined(Py_REF_DEBUG) && defined(Py_GIL_DISABLED) Py_ssize_t reftotal; // this thread's total refcount operations #endif -#if _Py_TIER2 +#if defined(_Py_TIER2) struct _PyJitTracerState *jit_tracer_state; #endif diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 475be76dc3da21b..24c12fcd1cb097d 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -279,7 +279,7 @@ framelocalsproxy_setitem(PyObject *self, PyObject *key, PyObject *value) return -1; } -#if _Py_TIER2 +#ifdef _Py_TIER2 _Py_Executors_InvalidateDependency(_PyInterpreterState_GET(), co, 1); #endif diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 99f08863da4604a..7cdda0ad180ef77 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -65,7 +65,7 @@ handle_func_event(PyFunction_WatchEvent event, PyFunctionObject *func, case PyFunction_EVENT_MODIFY_DEFAULTS: case PyFunction_EVENT_MODIFY_KWDEFAULTS: case PyFunction_EVENT_MODIFY_QUALNAME: -#if _Py_TIER2 +#ifdef _Py_TIER2 // Note: we only invalidate JIT code if a function version changes. // Not when the function is deallocated. // Function deallocation occurs frequently (think: lambdas), diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 42ad83daa1ea461..984b591cb18d103 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1548,7 +1548,7 @@ dummy_func( tstate->current_frame = frame->previous; assert(!_PyErr_Occurred(tstate)); PyObject *result = PyStackRef_AsPyObjectSteal(retval); -#if !_Py_TAIL_CALL_INTERP +#ifndef _Py_TAIL_CALL_INTERP assert(frame == &entry.frame); #endif #ifdef _Py_TIER2 @@ -1962,7 +1962,7 @@ dummy_func( tier1 inst(CLEANUP_THROW, (sub_iter, null_in, last_sent_val, exc_value_st -- none, null_out, value)) { PyObject *exc_value = PyStackRef_AsPyObjectBorrow(exc_value_st); - #if !_Py_TAIL_CALL_INTERP + #ifndef _Py_TAIL_CALL_INTERP assert(throwflag); #endif assert(exc_value && PyExceptionInstance_Check(exc_value)); @@ -6102,10 +6102,10 @@ dummy_func( } op(_SAVE_RETURN_OFFSET, (--)) { - #if TIER_ONE + #ifdef TIER_ONE frame->return_offset = (uint16_t)(next_instr - this_instr); #endif - #if TIER_TWO + #ifdef TIER_TWO frame->return_offset = oparg; #endif } @@ -6501,7 +6501,7 @@ dummy_func( } #endif RELOAD_STACK(); -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP int opcode; #endif DISPATCH(); @@ -6525,7 +6525,7 @@ dummy_func( if (frame->owner == FRAME_OWNED_BY_INTERPRETER) { /* Restore previous frame and exit */ tstate->current_frame = frame->previous; -#if !_Py_TAIL_CALL_INTERP +#ifndef _Py_TAIL_CALL_INTERP assert(frame == &entry.frame); #endif #ifdef _Py_TIER2 @@ -6565,14 +6565,14 @@ dummy_func( assert(!_PyErr_Occurred(tstate)); #endif RELOAD_STACK(); -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP int opcode; #endif DISPATCH(); } inst(TRACE_RECORD, (--)) { -#if _Py_TIER2 +#ifdef _Py_TIER2 assert(IS_JIT_TRACING()); next_instr = this_instr; frame->instr_ptr = prev_instr; @@ -6629,7 +6629,7 @@ dummy_func( } label(stop_tracing) { -#if _Py_TIER2 +#ifdef _Py_TIER2 assert(IS_JIT_TRACING()); int opcode = next_instr->op.code; _PyJit_translate_single_bytecode_to_trace(tstate, frame, NULL, _EXIT_TRACE); diff --git a/Python/ceval.c b/Python/ceval.c index ccc0edca2fc7940..ff7a3f6d1ba4501 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1038,7 +1038,7 @@ _PyObjectArray_Free(PyObject **array, PyObject **scratch) } } -#if _Py_TIER2 +#ifdef _Py_TIER2 // 0 for success, -1 for error. static int stop_tracing_and_jit(PyThreadState *tstate, _PyInterpreterFrame *frame) @@ -1066,7 +1066,7 @@ stop_tracing_and_jit(PyThreadState *tstate, _PyInterpreterFrame *frame) /* This setting is reversed below following _PyEval_EvalFrameDefault */ #endif -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP #include "opcode_targets.h" #include "generated_cases.c.h" #endif @@ -1213,7 +1213,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int check_invalid_reentrancy(); CALL_STAT_INC(pyeval_calls); -#if USE_COMPUTED_GOTOS && !_Py_TAIL_CALL_INTERP +#if USE_COMPUTED_GOTOS && !defined(_Py_TAIL_CALL_INTERP) /* Import the static jump table */ #include "opcode_targets.h" void **opcode_targets = opcode_targets_table; @@ -1222,7 +1222,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int #ifdef Py_STATS int lastopcode = 0; #endif -#if !_Py_TAIL_CALL_INTERP +#if !defined(_Py_TAIL_CALL_INTERP) uint8_t opcode; /* Current opcode */ int oparg; /* Current opcode argument, if any */ assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL); @@ -1301,7 +1301,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int monitor_throw(tstate, frame, next_instr); stack_pointer = _PyFrame_GetStackPointer(frame); _PyFrame_StackPointerInvalidate(frame); -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP # if Py_STATS return _TAIL_CALL_error(frame, stack_pointer, tstate, next_instr, instruction_funcptr_handler_table, 0, lastopcode); # else @@ -1312,7 +1312,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int #endif } -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP # if Py_STATS return _TAIL_CALL_start_frame(frame, NULL, tstate, NULL, instruction_funcptr_handler_table, 0, lastopcode); # else diff --git a/Python/ceval_macros.h b/Python/ceval_macros.h index 36921e35533433d..479e7d8d80f049e 100644 --- a/Python/ceval_macros.h +++ b/Python/ceval_macros.h @@ -79,7 +79,7 @@ # define TAIL_CALL_ARGS frame, stack_pointer, tstate, next_instr, instruction_funcptr_table, oparg #endif -#if _Py_TAIL_CALL_INTERP +#ifdef _Py_TAIL_CALL_INTERP # if defined(__clang__) || defined(__GNUC__) # if !_Py__has_attribute(preserve_none) || !_Py__has_attribute(musttail) # error "This compiler does not have support for efficient tail calling." @@ -144,7 +144,7 @@ # define LABEL(name) name: #endif -#if (_Py_TAIL_CALL_INTERP || USE_COMPUTED_GOTOS) && _Py_TIER2 +#if (defined(_Py_TAIL_CALL_INTERP) || USE_COMPUTED_GOTOS) && defined(_Py_TIER2) # define IS_JIT_TRACING() (DISPATCH_TABLE_VAR == TRACING_DISPATCH_TABLE) # define ENTER_TRACING() \ DISPATCH_TABLE_VAR = TRACING_DISPATCH_TABLE; @@ -156,7 +156,7 @@ # define LEAVE_TRACING() tracing_mode = 0 #endif -#if _Py_TIER2 +#ifdef _Py_TIER2 #define STOP_TRACING() \ do { \ if (IS_JIT_TRACING()) { \ diff --git a/Python/pystate.c b/Python/pystate.c index ce7197c4e054283..fd093cd6d6c8a2e 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -2053,7 +2053,7 @@ tstate_delete_common(PyThreadState *tstate, int release_gil, int is_unlinked) assert(tstate_impl->refcounts.values == NULL); #endif -#if _Py_TIER2 +#ifdef _Py_TIER2 _PyJit_TracerFree((_PyThreadStateImpl *)tstate); #endif