Skip to content

Commit f8fefb3

Browse files
fix a few bugs
1 parent cc38ee4 commit f8fefb3

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ PyAPI_FUNC(int) _PyDumpExecutors(FILE *out);
368368
extern void _Py_ClearExecutorDeletionList(PyThreadState *tstate);
369369
#endif
370370

371-
int _PyJit_translate_single_bytecode_to_trace(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *next_instr, bool stop_tracing);
371+
int _PyJit_translate_single_bytecode_to_trace(PyThreadState *tstate, _PyInterpreterFrame *frame, _Py_CODEUNIT *next_instr, int stop_tracing_exit);
372372

373373
int
374374
_PyJit_TryInitializeTracing(PyThreadState *tstate, _PyInterpreterFrame *frame,

Python/bytecodes.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,11 +3303,9 @@ dummy_func(
33033303

33043304
// Only used by Tier 2
33053305
op(_GUARD_NOT_EXHAUSTED_LIST, (iter, null_or_index -- iter, null_or_index)) {
3306-
#ifndef Py_GIL_DISABLED
33073306
PyObject *list_o = PyStackRef_AsPyObjectBorrow(iter);
33083307
assert(Py_TYPE(list_o) == &PyList_Type);
33093308
EXIT_IF((size_t)PyStackRef_UntagInt(null_or_index) >= (size_t)PyList_GET_SIZE(list_o));
3310-
#endif
33113309
}
33123310

33133311
replaced op(_ITER_NEXT_LIST, (iter, null_or_index -- iter, null_or_index, next)) {
@@ -5663,7 +5661,7 @@ dummy_func(
56635661
bool stop_tracing = (opcode == WITH_EXCEPT_START ||
56645662
opcode == RERAISE || opcode == CLEANUP_THROW ||
56655663
opcode == PUSH_EXC_INFO || opcode == INTERPRETER_EXIT);
5666-
int full = !_PyJit_translate_single_bytecode_to_trace(tstate, frame, next_instr, stop_tracing);
5664+
int full = !_PyJit_translate_single_bytecode_to_trace(tstate, frame, next_instr, stop_tracing ? _DEOPT : 0);
56675665
if (full) {
56685666
LEAVE_TRACING();
56695667
int err = stop_tracing_and_jit(tstate, frame);
@@ -5703,7 +5701,7 @@ dummy_func(
57035701
#if _Py_TIER2
57045702
assert(IS_JIT_TRACING());
57055703
int opcode = next_instr->op.code;
5706-
_PyJit_translate_single_bytecode_to_trace(tstate, frame, NULL, true);
5704+
_PyJit_translate_single_bytecode_to_trace(tstate, frame, NULL, _EXIT_TRACE);
57075705
LEAVE_TRACING();
57085706
int err = stop_tracing_and_jit(tstate, frame);
57095707
ERROR_IF(err < 0);

Python/ceval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ _PyTier2Interpreter(
13071307
for (;;) {
13081308
uopcode = next_uop->opcode;
13091309
#ifdef Py_DEBUG
1310-
if (frame->lltrace >= 3) {
1310+
if (frame->lltrace >= 4) {
13111311
dump_stack(frame, stack_pointer);
13121312
if (next_uop->opcode == _START_EXECUTOR) {
13131313
printf("%4d uop: ", 0);

Python/executor_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/generated_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.

Python/optimizer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ _PyJit_translate_single_bytecode_to_trace(
574574
PyThreadState *tstate,
575575
_PyInterpreterFrame *frame,
576576
_Py_CODEUNIT *next_instr,
577-
bool stop_tracing)
577+
int stop_tracing_exit)
578578
{
579579

580580
#ifdef Py_DEBUG
@@ -637,8 +637,8 @@ _PyJit_translate_single_bytecode_to_trace(
637637
goto full;
638638
}
639639

640-
if (stop_tracing) {
641-
ADD_TO_TRACE(_DEOPT, 0, 0, target);
640+
if (stop_tracing_exit) {
641+
ADD_TO_TRACE(stop_tracing_exit, 0, 0, target);
642642
goto done;
643643
}
644644

0 commit comments

Comments
 (0)