Skip to content

Commit 732c6b4

Browse files
Address review
1 parent 134d2a0 commit 732c6b4

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

Include/internal/pycore_frame.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ typedef struct _PyInterpreterFrame {
7575
_PyStackRef *stackpointer;
7676
uint16_t return_offset; /* Only relevant during a function call */
7777
char owner;
78-
char visited;
7978
#ifdef Py_DEBUG
80-
unsigned char lltrace;
79+
char visited:4;
80+
char lltrace:4;
81+
#else
82+
char visited;
8183
#endif
8284
/* Locals and stack */
8385
_PyStackRef localsplus[1];

Lib/test/test_sys.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,11 +1620,10 @@ class C(object): pass
16201620
def func():
16211621
return sys._getframe()
16221622
x = func()
1623-
LLTRACE = 'B' if support.Py_DEBUG else ''
16241623
if support.Py_GIL_DISABLED:
1625-
INTERPRETER_FRAME = f'10Phcc{LLTRACE}P'
1624+
INTERPRETER_FRAME = f'10PhcP'
16261625
else:
1627-
INTERPRETER_FRAME = f'9Phcc{LLTRACE}P'
1626+
INTERPRETER_FRAME = f'9PhcP'
16281627
check(x, size('3PiccPP' + INTERPRETER_FRAME + 'P'))
16291628
# function
16301629
def func(): pass

Python/bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4993,7 +4993,7 @@ dummy_func(
49934993
_Py_CODEUNIT *target = _PyFrame_GetBytecode(frame) + exit->target;
49944994
#if defined(Py_DEBUG) && !defined(_Py_JIT)
49954995
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
4996-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 2) {
4996+
if (frame->lltrace >= 2) {
49974997
printf("SIDE EXIT: [UOp ");
49984998
_PyUOpPrint(&next_uop[-1]);
49994999
printf(", exit %u, temp %d, target %d -> %s]\n",
@@ -5111,7 +5111,7 @@ dummy_func(
51115111
_Py_CODEUNIT *target = frame->instr_ptr;
51125112
#if defined(Py_DEBUG) && !defined(_Py_JIT)
51135113
OPT_HIST(trace_uop_execution_counter, trace_run_length_hist);
5114-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 2) {
5114+
if (frame->lltrace >= 2) {
51155115
printf("DYNAMIC EXIT: [UOp ");
51165116
_PyUOpPrint(&next_uop[-1]);
51175117
printf(", exit %u, temp %d, target %d -> %s]\n",

Python/ceval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10061006
}
10071007
/* Resume normal execution */
10081008
#ifdef LLTRACE
1009-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 5) {
1009+
if (frame->lltrace >= 5) {
10101010
lltrace_resume_frame(frame);
10111011
}
10121012
#endif
@@ -1083,7 +1083,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
10831083
for (;;) {
10841084
uopcode = next_uop->opcode;
10851085
#ifdef Py_DEBUG
1086-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 3) {
1086+
if (frame->lltrace >= 3) {
10871087
dump_stack(frame, stack_pointer);
10881088
if (next_uop->opcode == _START_EXECUTOR) {
10891089
printf("%4d uop: ", 0);
@@ -1125,7 +1125,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11251125

11261126
jump_to_error_target:
11271127
#ifdef Py_DEBUG
1128-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 2) {
1128+
if (frame->lltrace >= 2) {
11291129
printf("Error: [UOp ");
11301130
_PyUOpPrint(&next_uop[-1]);
11311131
printf(" @ %d -> %s]\n",
@@ -1161,7 +1161,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11611161
next_instr = next_uop[-1].target + _PyFrame_GetBytecode(frame);
11621162
goto_to_tier1:
11631163
#ifdef Py_DEBUG
1164-
if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 2) {
1164+
if (frame->lltrace >= 2) {
11651165
printf("DEOPT: [UOp ");
11661166
_PyUOpPrint(&next_uop[-1]);
11671167
printf(" -> %s]\n",

Python/ceval_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080

8181
/* PRE_DISPATCH_GOTO() does lltrace if enabled. Normally a no-op */
8282
#ifdef LLTRACE
83-
#define PRE_DISPATCH_GOTO() if (FT_ATOMIC_LOAD_UINT8_RELAXED(frame->lltrace) >= 5) { \
83+
#define PRE_DISPATCH_GOTO() if (frame->lltrace >= 5) { \
8484
lltrace_instruction(frame, stack_pointer, next_instr, opcode, oparg); }
8585
#else
8686
#define PRE_DISPATCH_GOTO() ((void)0)

Python/executor_cases.c.h

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

0 commit comments

Comments
 (0)