Skip to content

Commit 2032b9c

Browse files
add back replaced, move jit tracing env var to
1 parent 0ffc2dd commit 2032b9c

File tree

8 files changed

+15
-65
lines changed

8 files changed

+15
-65
lines changed

Include/internal/pycore_interp_structs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,7 @@ struct _is {
944944
struct callable_cache callable_cache;
945945
PyObject *common_consts[NUM_COMMON_CONSTANTS];
946946
// JIT tracing state
947+
bool jit_is_tracing;
947948
int jit_tracer_code_max_size;
948949
int jit_tracer_code_curr_size;
949950
_PyBloomFilter jit_tracer_dependencies;

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ dummy_func(
33103310
#endif
33113311
}
33123312

3313-
op(_ITER_NEXT_LIST, (iter, null_or_index -- iter, null_or_index, next)) {
3313+
replaced op(_ITER_NEXT_LIST, (iter, null_or_index -- iter, null_or_index, next)) {
33143314
PyObject *list_o = PyStackRef_AsPyObjectBorrow(iter);
33153315
assert(PyList_CheckExact(list_o));
33163316
#ifdef Py_GIL_DISABLED

Python/ceval_macros.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@
136136
JUMP_TO_LABEL(label);
137137

138138
#if _Py_TAIL_CALL_INTERP || USE_COMPUTED_GOTOS
139-
# define IS_JIT_TRACING() (DISPATCH_TABLE_VAR == TRACING_DISPATCH_TABLE)
140-
# define ENTER_TRACING() DISPATCH_TABLE_VAR = TRACING_DISPATCH_TABLE;
141-
# define LEAVE_TRACING() DISPATCH_TABLE_VAR = DISPATCH_TABLE;
139+
# define IS_JIT_TRACING() (tstate->interp->jit_is_tracing)
140+
# define ENTER_TRACING() \
141+
assert(!IS_JIT_TRACING()); \
142+
DISPATCH_TABLE_VAR = TRACING_DISPATCH_TABLE; \
143+
tstate->interp->jit_is_tracing = true;
144+
# define LEAVE_TRACING() \
145+
assert(IS_JIT_TRACING()); \
146+
DISPATCH_TABLE_VAR = DISPATCH_TABLE; \
147+
tstate->interp->jit_is_tracing = false;
142148
# define BAIL_TRACING_NO_DISPATCH() \
143149
LEAVE_TRACING(); \
144150
_PyFrame_SetStackPointer(frame, stack_pointer); \
@@ -148,14 +154,6 @@
148154
if (_err < 0) { \
149155
JUMP_TO_LABEL(error); \
150156
}
151-
# define BAIL_TRACING() \
152-
BAIL_TRACING_NO_DISPATCH() \
153-
DISPATCH();
154-
# define RECORD_TRACE() do { \
155-
if (add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
156-
BAIL_TRACING(); \
157-
} \
158-
} while (0);
159157
# define RECORD_TRACE_NO_DISPATCH() do { \
160158
if (add_to_code_trace(tstate, frame, old_code, old_func, this_instr, next_instr, opcode, oparg, _jump_taken)) { \
161159
BAIL_TRACING_NO_DISPATCH(); \
@@ -224,7 +222,7 @@ do { \
224222
#define TRACING_DISPATCH() \
225223
{ \
226224
assert(frame->stackpointer == NULL); \
227-
RECORD_TRACE(); \
225+
RECORD_TRACE_NO_DISPATCH(); \
228226
NEXTOPARG(); \
229227
PRE_DISPATCH_GOTO(); \
230228
DISPATCH_GOTO(); \
@@ -414,7 +412,6 @@ _PyFrame_SetStackPointer(frame, stack_pointer)
414412

415413
#define TIER1_TO_TIER2(EXECUTOR) \
416414
do { \
417-
LEAVE_TRACING(); \
418415
OPT_STAT_INC(traces_executed); \
419416
next_instr = _Py_jit_entry((EXECUTOR), frame, stack_pointer, tstate); \
420417
frame = tstate->current_frame; \

Python/executor_cases.c.h

Lines changed: 1 addition & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_cases.c.h

Lines changed: 1 addition & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)