Skip to content

Commit 543971c

Browse files
committed
remove cur_len
1 parent 15f32b9 commit 543971c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Python/optimizer_analysis.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ optimize_uops(
395395
ctx->curr_frame_depth++;
396396
ctx->frame = frame;
397397

398-
int *cur_len = &ctx->out_len;
399-
*cur_len = 0;
398+
ctx->out_len = 0;
400399

401400
_PyUOpInstruction *this_instr = NULL;
402401
JitOptRef *stack_pointer = ctx->frame->stack_pointer;
@@ -429,8 +428,8 @@ optimize_uops(
429428
Py_UNREACHABLE();
430429
}
431430
// If no ADD_OP was called during this iteration, copy the original instruction
432-
if (*cur_len == i) {
433-
ctx->out_buffer[(*cur_len)++] = *this_instr;
431+
if (ctx->out_len == i) {
432+
ctx->out_buffer[ctx->out_len++] = *this_instr;
434433
}
435434
assert(ctx->frame != NULL);
436435
if (!CURRENT_FRAME_IS_INIT_SHIM()) {
@@ -461,20 +460,20 @@ optimize_uops(
461460
* would be no benefit in retrying later */
462461
_Py_uop_abstractcontext_fini(ctx);
463462
// Check that the trace ends with a proper terminator
464-
if (*cur_len > 0) {
465-
_PyUOpInstruction *last_uop = &ctx->out_buffer[*cur_len - 1];
463+
if (ctx->out_len > 0) {
464+
_PyUOpInstruction *last_uop = &ctx->out_buffer[ctx->out_len - 1];
466465
if (!is_terminator_uop(last_uop)) {
467466
// Copy remaining uops from original trace until we find a terminator
468-
for (int i = *cur_len; i < trace_len; i++) {
469-
ctx->out_buffer[(*cur_len)++] = trace[i];
467+
for (int i = ctx->out_len; i < trace_len; i++) {
468+
ctx->out_buffer[ctx->out_len++] = trace[i];
470469
if (is_terminator_uop(&trace[i])) {
471470
break;
472471
}
473472
}
474473
}
475474
}
476475

477-
return *cur_len;
476+
return ctx->out_len;
478477

479478
error:
480479
DPRINTF(3, "\n");

0 commit comments

Comments
 (0)