Skip to content

Commit cdcce30

Browse files
Address review of macros
1 parent 676faf8 commit cdcce30

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
A new tracing frontend for the JIT compiler has been implemented. Patch by Ken Jin. Design for CPython by Brandt Bucher, Mark Shannon and Ken Jin.
1+
A new tracing frontend for the JIT compiler has been implemented. Patch by Ken Jin. Design for CPython by Mark Shannon, Ken Jin and Brandt Bucher.

Python/bytecodes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5420,12 +5420,12 @@ dummy_func(
54205420
}
54215421

54225422
tier2 op(_DEOPT, (--)) {
5423-
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET(), 0);
5423+
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
54245424
}
54255425

54265426
tier2 op(_HANDLE_PENDING_AND_DEOPT, (--)) {
54275427
int err = _Py_HandlePending(tstate);
5428-
GOTO_TIER_ONE(err ? NULL : _PyFrame_GetBytecode(frame) + CURRENT_TARGET(), 0);
5428+
GOTO_TIER_ONE(err ? NULL : _PyFrame_GetBytecode(frame) + CURRENT_TARGET());
54295429
}
54305430

54315431
tier2 op(_ERROR_POP_N, (target/2 --)) {
@@ -5435,7 +5435,7 @@ dummy_func(
54355435
// gh-140104: The exception handler expects frame->instr_ptr to be pointing to next_instr, not this_instr!
54365436
frame->instr_ptr = next_instr;
54375437
SYNC_SP();
5438-
GOTO_TIER_ONE(NULL, 0);
5438+
GOTO_TIER_ONE(NULL);
54395439
}
54405440

54415441
/* Progress is guaranteed if we DEOPT on the eval breaker, because
@@ -5457,7 +5457,7 @@ dummy_func(
54575457
_Py_BackoffCounter temperature = exit->temperature;
54585458
if (!backoff_counter_triggers(temperature)) {
54595459
exit->temperature = advance_backoff_counter(temperature);
5460-
GOTO_TIER_ONE(target, 0);
5460+
GOTO_TIER_ONE(target);
54615461
}
54625462
_PyExecutorObject *executor;
54635463
if (target->op.code == ENTER_EXECUTOR) {
@@ -5474,7 +5474,7 @@ dummy_func(
54745474
// So setting it to anything else is wrong.
54755475
_PyJit_InitializeTracing(tstate, frame, target, target, target, STACK_LEVEL(), chain_depth, exit, target->op.arg);
54765476
exit->temperature = initial_temperature_backoff_counter();
5477-
GOTO_TIER_ONE(target, 1);
5477+
GOTO_TIER_ONE_CONTINUE_TRACING(target);
54785478
}
54795479
assert(tstate->jit_exit == exit);
54805480
exit->executor = executor;
@@ -5508,7 +5508,7 @@ dummy_func(
55085508
TIER2_TO_TIER2(executor);
55095509
}
55105510
else {
5511-
GOTO_TIER_ONE(target, 0);
5511+
GOTO_TIER_ONE(target);
55125512
}
55135513
}
55145514

Python/ceval_macros.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,23 @@ do { \
440440
goto tier2_start; \
441441
} while (0)
442442

443-
#define GOTO_TIER_ONE(TARGET, SHOULD_CONTINUE_TRACING) \
444-
do \
445-
{ \
446-
tstate->current_executor = NULL; \
447-
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); \
448-
_PyFrame_SetStackPointer(frame, stack_pointer); \
449-
return (_Py_CODEUNIT *)(((uintptr_t)(TARGET)) | SHOULD_CONTINUE_TRACING); \
443+
#define GOTO_TIER_ONE_SETUP \
444+
tstate->current_executor = NULL; \
445+
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist); \
446+
_PyFrame_SetStackPointer(frame, stack_pointer);
447+
448+
#define GOTO_TIER_ONE(TARGET) \
449+
do \
450+
{ \
451+
GOTO_TIER_ONE_SETUP \
452+
return (_Py_CODEUNIT *)(TARGET); \
453+
} while (0)
454+
455+
#define GOTO_TIER_ONE_CONTINUE_TRACING(TARGET) \
456+
do \
457+
{ \
458+
GOTO_TIER_ONE_SETUP \
459+
return (_Py_CODEUNIT *)(((uintptr_t)(TARGET))| 1); \
450460
} while (0)
451461

452462
#define CURRENT_OPARG() (next_uop[-1].oparg)

Python/executor_cases.c.h

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

0 commit comments

Comments
 (0)