GH-125837: Split LOAD_CONST into three. (GH-125972)

* Add LOAD_CONST_IMMORTAL opcode

* Add LOAD_SMALL_INT opcode

* Remove RETURN_CONST opcode
This commit is contained in:
Mark Shannon 2024-10-29 11:15:42 +00:00 committed by GitHub
parent 67f5c5bd6f
commit faa3272fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 706 additions and 538 deletions

View file

@ -445,6 +445,17 @@ dummy_func(void) {
value = sym_new_const(ctx, val);
}
op(_LOAD_CONST_IMMORTAL, (-- value)) {
PyObject *val = PyTuple_GET_ITEM(co->co_consts, this_instr->oparg);
REPLACE_OP(this_instr, _LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
value = sym_new_const(ctx, val);
}
op(_LOAD_SMALL_INT, (-- value)) {
PyObject *val = PyLong_FromLong(this_instr->oparg);
value = sym_new_const(ctx, val);
}
op(_LOAD_CONST_INLINE, (ptr/4 -- value)) {
value = sym_new_const(ctx, ptr);
}