diff --git a/Modules/_testinternalcapi/test_targets.h b/Modules/_testinternalcapi/test_targets.h index 91b424773224e4b..9f9d4ff89190c97 100644 --- a/Modules/_testinternalcapi/test_targets.h +++ b/Modules/_testinternalcapi/test_targets.h @@ -520,7 +520,9 @@ static void *opcode_tracing_targets_table[256] = { #else /* _Py_TAIL_CALL_INTERP */ static py_tail_call_funcptr instruction_funcptr_handler_table[256]; +#if _Py_TIER2 static py_tail_call_funcptr instruction_funcptr_tracing_table[256]; +#endif static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_pop_2_error(TAIL_CALL_PARAMS); static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_pop_1_error(TAIL_CALL_PARAMS); @@ -1031,6 +1033,7 @@ static py_tail_call_funcptr instruction_funcptr_handler_table[256] = { [231] = _TAIL_CALL_UNKNOWN_OPCODE, [232] = _TAIL_CALL_UNKNOWN_OPCODE, }; +#if _Py_TIER2 static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = { [BINARY_OP] = _TAIL_CALL_TRACE_RECORD, [BINARY_OP_ADD_FLOAT] = _TAIL_CALL_TRACE_RECORD, @@ -1289,4 +1292,5 @@ static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = { [231] = _TAIL_CALL_UNKNOWN_OPCODE, [232] = _TAIL_CALL_UNKNOWN_OPCODE, }; +#endif #endif /* _Py_TAIL_CALL_INTERP */ diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 91b424773224e4b..9f9d4ff89190c97 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -520,7 +520,9 @@ static void *opcode_tracing_targets_table[256] = { #else /* _Py_TAIL_CALL_INTERP */ static py_tail_call_funcptr instruction_funcptr_handler_table[256]; +#if _Py_TIER2 static py_tail_call_funcptr instruction_funcptr_tracing_table[256]; +#endif static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_pop_2_error(TAIL_CALL_PARAMS); static PyObject *Py_PRESERVE_NONE_CC _TAIL_CALL_pop_1_error(TAIL_CALL_PARAMS); @@ -1031,6 +1033,7 @@ static py_tail_call_funcptr instruction_funcptr_handler_table[256] = { [231] = _TAIL_CALL_UNKNOWN_OPCODE, [232] = _TAIL_CALL_UNKNOWN_OPCODE, }; +#if _Py_TIER2 static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = { [BINARY_OP] = _TAIL_CALL_TRACE_RECORD, [BINARY_OP_ADD_FLOAT] = _TAIL_CALL_TRACE_RECORD, @@ -1289,4 +1292,5 @@ static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = { [231] = _TAIL_CALL_UNKNOWN_OPCODE, [232] = _TAIL_CALL_UNKNOWN_OPCODE, }; +#endif #endif /* _Py_TAIL_CALL_INTERP */ diff --git a/Tools/cases_generator/target_generator.py b/Tools/cases_generator/target_generator.py index e7cf6c223d22dc9..a7a9154051d6eaf 100644 --- a/Tools/cases_generator/target_generator.py +++ b/Tools/cases_generator/target_generator.py @@ -50,7 +50,9 @@ def function_proto(name: str) -> str: def write_tailcall_dispatch_table(analysis: Analysis, out: CWriter) -> None: out.emit("static py_tail_call_funcptr instruction_funcptr_handler_table[256];\n") out.emit("\n") + out.emit("#if _Py_TIER2\n") out.emit("static py_tail_call_funcptr instruction_funcptr_tracing_table[256];\n") + out.emit("#endif\n") out.emit("\n") # Emit function prototypes for labels. @@ -82,6 +84,7 @@ def write_tailcall_dispatch_table(analysis: Analysis, out: CWriter) -> None: out.emit("};\n") # Emit the tracing dispatch table. + out.emit("#if _Py_TIER2\n") out.emit("static py_tail_call_funcptr instruction_funcptr_tracing_table[256] = {\n") for name in sorted(analysis.instructions.keys()): out.emit(f"[{name}] = _TAIL_CALL_TRACE_RECORD,\n") @@ -90,6 +93,7 @@ def write_tailcall_dispatch_table(analysis: Analysis, out: CWriter) -> None: if rest not in named_values: out.emit(f"[{rest}] = _TAIL_CALL_UNKNOWN_OPCODE,\n") out.emit("};\n") + out.emit("#endif\n") outfile.write("#endif /* _Py_TAIL_CALL_INTERP */\n") arg_parser = argparse.ArgumentParser(