summaryrefslogtreecommitdiffstats
path: root/Python/optimizer.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2024-03-05 18:05:29 (GMT)
committerGitHub <noreply@github.com>2024-03-05 18:05:29 (GMT)
commitd444dec09ae05150f0d339a060fca23990d4834e (patch)
tree326715795483751d8baec7296a66c33a0bb6964b /Python/optimizer.c
parente7ba6e9dbe5433b4a0bcb0658da6a68197c28630 (diff)
downloadcpython-d444dec09ae05150f0d339a060fca23990d4834e.zip
cpython-d444dec09ae05150f0d339a060fca23990d4834e.tar.gz
cpython-d444dec09ae05150f0d339a060fca23990d4834e.tar.bz2
Fix debug output for optimized executor (#116337)
This adjusts `length` rather than using `length+1` all over the place.
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r--Python/optimizer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index acd6d52..4dbfd91 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -899,7 +899,8 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
uint32_t used[(UOP_MAX_TRACE_LENGTH + 31)/32] = { 0 };
int exit_count;
int length = compute_used(buffer, used, &exit_count);
- _PyExecutorObject *executor = allocate_executor(exit_count, length+1);
+ length += 1; // For _START_EXECUTOR
+ _PyExecutorObject *executor = allocate_executor(exit_count, length);
if (executor == NULL) {
return NULL;
}
@@ -909,7 +910,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
executor->exits[i].temperature = 0;
}
int next_exit = exit_count-1;
- _PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length];
+ _PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length-1];
/* Scan backwards, so that we see the destinations of jumps before the jumps themselves. */
for (int i = UOP_MAX_TRACE_LENGTH-1; i >= 0; i--) {
if (!BIT_IS_SET(used, i)) {
@@ -957,7 +958,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
#ifdef _Py_JIT
executor->jit_code = NULL;
executor->jit_size = 0;
- if (_PyJIT_Compile(executor, executor->trace, length+1)) {
+ if (_PyJIT_Compile(executor, executor->trace, length)) {
Py_DECREF(executor);
return NULL;
}