mirror of
https://github.com/python/cpython.git
synced 2026-06-05 01:10:53 +00:00
gh-148871: make LOAD_COMMON_CONSTANT use immortal stackref borrows (GH-149625)
This commit is contained in:
parent
2531cd337b
commit
39bd44fc70
12 changed files with 96 additions and 43 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "pycore_long.h"
|
||||
#include "pycore_opcode_utils.h"
|
||||
#include "pycore_optimizer.h"
|
||||
#include "pycore_stackref.h"
|
||||
#include "pycore_typeobject.h"
|
||||
#include "pycore_uops.h"
|
||||
#include "pycore_uop_ids.h"
|
||||
|
|
@ -870,15 +871,11 @@ dummy_func(void) {
|
|||
|
||||
op(_LOAD_COMMON_CONSTANT, (-- value)) {
|
||||
assert(oparg < NUM_COMMON_CONSTANTS);
|
||||
PyObject *val = _PyInterpreterState_GET()->common_consts[oparg];
|
||||
if (_Py_IsImmortal(val)) {
|
||||
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
|
||||
value = PyJitRef_Borrow(sym_new_const(ctx, val));
|
||||
}
|
||||
else {
|
||||
ADD_OP(_LOAD_CONST_INLINE, 0, (uintptr_t)val);
|
||||
value = sym_new_const(ctx, val);
|
||||
}
|
||||
PyObject *val = PyStackRef_AsPyObjectBorrow(
|
||||
_PyInterpreterState_GET()->common_consts[oparg]);
|
||||
assert(_Py_IsImmortal(val));
|
||||
ADD_OP(_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)val);
|
||||
value = PyJitRef_Borrow(sym_new_const(ctx, val));
|
||||
}
|
||||
|
||||
op(_LOAD_SMALL_INT, (-- value)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue