Skip to content

Commit 043f978

Browse files
committed
Account for LOAD_CONST_MORTAL in jit optimizer.
1 parent e7a7f22 commit 043f978

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Python/optimizer_bytecodes.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,13 @@ dummy_func(void) {
479479
value = sym_new_const(ctx, val);
480480
}
481481

482+
op(_LOAD_CONST_MORTAL, (-- value)) {
483+
PyObject *val = PyTuple_GET_ITEM(co->co_consts, this_instr->oparg);
484+
int opcode = _Py_IsImmortal(val) ? _LOAD_CONST_INLINE_BORROW : _LOAD_CONST_INLINE;
485+
REPLACE_OP(this_instr, opcode, 0, (uintptr_t)val);
486+
value = sym_new_const(ctx, val);
487+
}
488+
482489
op(_LOAD_CONST_IMMORTAL, (-- value)) {
483490
PyObject *val = PyTuple_GET_ITEM(co->co_consts, this_instr->oparg);
484491
REPLACE_OP(this_instr, _LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);

Python/optimizer_cases.c.h

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