Skip to content

Commit dd0e16f

Browse files
Fix a bug with where the executors get inserted during EXTENDED_ARG
1 parent 55892a4 commit dd0e16f

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

Include/internal/pycore_uop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef struct _PyUOpInstruction{
3636
} _PyUOpInstruction;
3737

3838
// This is the length of the trace we translate initially.
39-
#define UOP_MAX_TRACE_LENGTH 1400
39+
#define UOP_MAX_TRACE_LENGTH 1500
4040
#define UOP_BUFFER_SIZE (UOP_MAX_TRACE_LENGTH * sizeof(_PyUOpInstruction))
4141

4242
/* Bloom filter with m = 256

Python/bytecodes.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,13 @@ dummy_func(
29792979
}
29802980
int _is_sys_tracing = (tstate->c_tracefunc != NULL) || (tstate->c_profilefunc != NULL);
29812981
if (!_is_sys_tracing) {
2982-
_PyJIT_InitializeTracing(tstate, frame, this_instr, next_instr, STACK_LEVEL(), 0, NULL);
2982+
/* Back up over EXTENDED_ARGs so executor is inserted at the corret place */
2983+
_Py_CODEUNIT *insert_exec_at = this_instr;
2984+
while (oparg > 255) {
2985+
oparg >>= 8;
2986+
insert_exec_at--;
2987+
}
2988+
_PyJIT_InitializeTracing(tstate, frame, insert_exec_at, next_instr, STACK_LEVEL(), 0, NULL);
29832989
ENTER_TRACING();
29842990
}
29852991
int _jump_taken = false;

Python/generated_cases.c.h

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

Python/generated_tracer_cases.c.h

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

0 commit comments

Comments
 (0)