Skip to content

Commit 97c6cdc

Browse files
committed
Teach optimizer about LOAD_INT
1 parent 8f2a781 commit 97c6cdc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Python/optimizer_bytecodes.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,17 @@ dummy_func(void) {
427427
value = sym_new_const(ctx, val);
428428
}
429429

430-
431430
op(_LOAD_CONST_IMMORTAL, (-- value)) {
432431
PyObject *val = PyTuple_GET_ITEM(co->co_consts, this_instr->oparg);
433432
REPLACE_OP(this_instr, _LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
434433
value = sym_new_const(ctx, val);
435434
}
436435

436+
op(_LOAD_INT, (-- value)) {
437+
PyObject *val = PyLong_FromLong(this_instr->oparg);
438+
value = sym_new_const(ctx, val);
439+
}
440+
437441
op(_LOAD_CONST_INLINE, (ptr/4 -- value)) {
438442
value = sym_new_const(ctx, ptr);
439443
}

Python/optimizer_cases.c.h

Lines changed: 2 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)