mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
gh-120619: Strength reduce function guards, support 2-operand uop forms (GH-124846)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
This commit is contained in:
parent
f8276bf5f3
commit
6293d00e72
17 changed files with 379 additions and 270 deletions
|
@ -661,7 +661,7 @@ dummy_func(
|
|||
assert(next_instr->op.code == STORE_FAST);
|
||||
next_oparg = next_instr->op.arg;
|
||||
#else
|
||||
next_oparg = CURRENT_OPERAND();
|
||||
next_oparg = CURRENT_OPERAND0();
|
||||
#endif
|
||||
_PyStackRef *target_local = &GETLOCAL(next_oparg);
|
||||
DEOPT_IF(!PyStackRef_Is(*target_local, left));
|
||||
|
@ -3463,6 +3463,12 @@ dummy_func(
|
|||
EXIT_IF(func->func_version != func_version);
|
||||
}
|
||||
|
||||
tier2 op(_CHECK_FUNCTION_VERSION_INLINE, (func_version/2, callable_o/4 --)) {
|
||||
assert(PyFunction_Check(callable_o));
|
||||
PyFunctionObject *func = (PyFunctionObject *)callable_o;
|
||||
EXIT_IF(func->func_version != func_version);
|
||||
}
|
||||
|
||||
macro(CALL_PY_GENERAL) =
|
||||
unused/1 + // Skip over the counter
|
||||
_CHECK_PEP_523 +
|
||||
|
|
|
@ -413,7 +413,8 @@ do { \
|
|||
|
||||
#define CURRENT_OPARG() (next_uop[-1].oparg)
|
||||
|
||||
#define CURRENT_OPERAND() (next_uop[-1].operand)
|
||||
#define CURRENT_OPERAND0() (next_uop[-1].operand0)
|
||||
#define CURRENT_OPERAND1() (next_uop[-1].operand1)
|
||||
|
||||
#define JUMP_TO_JUMP_TARGET() goto jump_to_jump_target
|
||||
#define JUMP_TO_ERROR() goto jump_to_error_target
|
||||
|
|
108
Python/executor_cases.c.h
generated
108
Python/executor_cases.c.h
generated
|
@ -831,7 +831,7 @@
|
|||
assert(next_instr->op.code == STORE_FAST);
|
||||
next_oparg = next_instr->op.arg;
|
||||
#else
|
||||
next_oparg = CURRENT_OPERAND();
|
||||
next_oparg = CURRENT_OPERAND0();
|
||||
#endif
|
||||
_PyStackRef *target_local = &GETLOCAL(next_oparg);
|
||||
if (!PyStackRef_Is(*target_local, left)) {
|
||||
|
@ -1864,7 +1864,7 @@
|
|||
}
|
||||
|
||||
case _GUARD_GLOBALS_VERSION: {
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictObject *dict = (PyDictObject *)GLOBALS();
|
||||
if (!PyDict_CheckExact(dict)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -1880,7 +1880,7 @@
|
|||
|
||||
case _GUARD_GLOBALS_VERSION_PUSH_KEYS: {
|
||||
PyDictKeysObject *globals_keys;
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictObject *dict = (PyDictObject *)GLOBALS();
|
||||
if (!PyDict_CheckExact(dict)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -1900,7 +1900,7 @@
|
|||
|
||||
case _GUARD_BUILTINS_VERSION_PUSH_KEYS: {
|
||||
PyDictKeysObject *builtins_keys;
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t version = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictObject *dict = (PyDictObject *)BUILTINS();
|
||||
if (!PyDict_CheckExact(dict)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -1924,7 +1924,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
globals_keys = (PyDictKeysObject *)stack_pointer[-1].bits;
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(globals_keys);
|
||||
PyObject *res_o = entries[index].me_value;
|
||||
stack_pointer += -1;
|
||||
|
@ -1950,7 +1950,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
builtins_keys = (PyDictKeysObject *)stack_pointer[-1].bits;
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(builtins_keys);
|
||||
PyObject *res_o = entries[index].me_value;
|
||||
stack_pointer += -1;
|
||||
|
@ -2523,7 +2523,7 @@
|
|||
case _GUARD_TYPE_VERSION: {
|
||||
_PyStackRef owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyTypeObject *tp = Py_TYPE(PyStackRef_AsPyObjectBorrow(owner));
|
||||
assert(type_version != 0);
|
||||
if (tp->tp_version_tag != type_version) {
|
||||
|
@ -2552,7 +2552,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
PyObject **value_ptr = (PyObject**)(((char *)owner_o) + offset);
|
||||
PyObject *attr_o = *value_ptr;
|
||||
|
@ -2575,7 +2575,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
PyObject **value_ptr = (PyObject**)(((char *)owner_o) + offset);
|
||||
PyObject *attr_o = *value_ptr;
|
||||
|
@ -2600,7 +2600,7 @@
|
|||
case _CHECK_ATTR_MODULE: {
|
||||
_PyStackRef owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t dict_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t dict_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
if (!PyModule_CheckExact(owner_o)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -2621,7 +2621,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner_o)->md_dict;
|
||||
assert(dict->ma_keys->dk_kind == DICT_KEYS_UNICODE);
|
||||
|
@ -2664,7 +2664,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t hint = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t hint = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
PyObject *attr_o;
|
||||
PyDictObject *dict = _PyObject_GetManagedDict(owner_o);
|
||||
|
@ -2705,7 +2705,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
char *addr = (char *)owner_o + index;
|
||||
PyObject *attr_o = *(PyObject **)addr;
|
||||
|
@ -2727,7 +2727,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
char *addr = (char *)owner_o + index;
|
||||
PyObject *attr_o = *(PyObject **)addr;
|
||||
|
@ -2751,7 +2751,7 @@
|
|||
case _CHECK_ATTR_CLASS: {
|
||||
_PyStackRef owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
if (!PyType_Check(owner_o)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -2771,7 +2771,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
assert(descr != NULL);
|
||||
attr = PyStackRef_FromPyObjectNew(descr);
|
||||
|
@ -2787,7 +2787,7 @@
|
|||
_PyStackRef null = PyStackRef_NULL;
|
||||
(void)null;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
assert(descr != NULL);
|
||||
attr = PyStackRef_FromPyObjectNew(descr);
|
||||
|
@ -2807,7 +2807,7 @@
|
|||
_PyInterpreterFrame *new_frame;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *fget = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *fget = (PyObject *)CURRENT_OPERAND0();
|
||||
assert((oparg & 1) == 0);
|
||||
assert(Py_IS_TYPE(fget, &PyFunction_Type));
|
||||
PyFunctionObject *f = (PyFunctionObject *)fget;
|
||||
|
@ -2859,7 +2859,7 @@
|
|||
_PyStackRef value;
|
||||
owner = stack_pointer[-1];
|
||||
value = stack_pointer[-2];
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t offset = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
STAT_INC(STORE_ATTR, hit);
|
||||
assert(_PyObject_GetManagedDict(owner_o) == NULL);
|
||||
|
@ -2886,7 +2886,7 @@
|
|||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
value = stack_pointer[-2];
|
||||
uint16_t hint = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t hint = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
assert(Py_TYPE(owner_o)->tp_flags & Py_TPFLAGS_MANAGED_DICT);
|
||||
PyDictObject *dict = _PyObject_GetManagedDict(owner_o);
|
||||
|
@ -2937,7 +2937,7 @@
|
|||
_PyStackRef value;
|
||||
owner = stack_pointer[-1];
|
||||
value = stack_pointer[-2];
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
|
||||
char *addr = (char *)owner_o + index;
|
||||
STAT_INC(STORE_ATTR, hit);
|
||||
|
@ -3780,7 +3780,7 @@
|
|||
case _GUARD_KEYS_VERSION: {
|
||||
_PyStackRef owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t keys_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t keys_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyTypeObject *owner_cls = Py_TYPE(PyStackRef_AsPyObjectBorrow(owner));
|
||||
PyHeapTypeObject *owner_heap_type = (PyHeapTypeObject *)owner_cls;
|
||||
if (owner_heap_type->ht_cached_keys->dk_version != keys_version) {
|
||||
|
@ -3796,7 +3796,7 @@
|
|||
_PyStackRef self = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
assert(oparg & 1);
|
||||
/* Cached method object */
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
|
@ -3817,7 +3817,7 @@
|
|||
_PyStackRef self = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
assert(oparg & 1);
|
||||
assert(Py_TYPE(PyStackRef_AsPyObjectBorrow(owner))->tp_dictoffset == 0);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
|
@ -3837,7 +3837,7 @@
|
|||
_PyStackRef attr;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
assert((oparg & 1) == 0);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
assert(descr != NULL);
|
||||
|
@ -3852,7 +3852,7 @@
|
|||
_PyStackRef attr;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
assert((oparg & 1) == 0);
|
||||
assert(Py_TYPE(PyStackRef_AsPyObjectBorrow(owner))->tp_dictoffset == 0);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
|
@ -3866,7 +3866,7 @@
|
|||
case _CHECK_ATTR_METHOD_LAZY_DICT: {
|
||||
_PyStackRef owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t dictoffset = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t dictoffset = (uint16_t)CURRENT_OPERAND0();
|
||||
char *ptr = ((char *)PyStackRef_AsPyObjectBorrow(owner)) + MANAGED_DICT_OFFSET + dictoffset;
|
||||
PyObject *dict = *(PyObject **)ptr;
|
||||
/* This object has a __dict__, just not yet created */
|
||||
|
@ -3883,7 +3883,7 @@
|
|||
_PyStackRef self = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *descr = (PyObject *)CURRENT_OPERAND0();
|
||||
assert(oparg & 1);
|
||||
STAT_INC(LOAD_ATTR, hit);
|
||||
assert(descr != NULL);
|
||||
|
@ -3967,7 +3967,7 @@
|
|||
_PyStackRef *callable;
|
||||
oparg = CURRENT_OPARG();
|
||||
callable = &stack_pointer[-2 - oparg];
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||
if (!PyFunction_Check(callable_o)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -3981,13 +3981,25 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CHECK_FUNCTION_VERSION_INLINE: {
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = (PyObject *)CURRENT_OPERAND1();
|
||||
assert(PyFunction_Check(callable_o));
|
||||
PyFunctionObject *func = (PyFunctionObject *)callable_o;
|
||||
if (func->func_version != func_version) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_METHOD_VERSION: {
|
||||
_PyStackRef *null;
|
||||
_PyStackRef *callable;
|
||||
oparg = CURRENT_OPARG();
|
||||
null = &stack_pointer[-1 - oparg];
|
||||
callable = &stack_pointer[-2 - oparg];
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||
if (Py_TYPE(callable_o) != &PyMethod_Type) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -4443,7 +4455,7 @@
|
|||
callable = &stack_pointer[-2 - oparg];
|
||||
init = &stack_pointer[-2 - oparg];
|
||||
self = &stack_pointer[-1 - oparg];
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t type_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||
if (!PyStackRef_IsNull(null[0])) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -5201,7 +5213,7 @@
|
|||
_PyStackRef *callable;
|
||||
oparg = CURRENT_OPARG();
|
||||
callable = &stack_pointer[-3 - oparg];
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||
if (!PyFunction_Check(callable_o)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -5221,7 +5233,7 @@
|
|||
oparg = CURRENT_OPARG();
|
||||
null = &stack_pointer[-2 - oparg];
|
||||
callable = &stack_pointer[-3 - oparg];
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
|
||||
if (Py_TYPE(callable_o) != &PyMethod_Type) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -5659,13 +5671,13 @@
|
|||
}
|
||||
|
||||
case _SET_IP: {
|
||||
PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
frame->instr_ptr = (_Py_CODEUNIT *)instr_ptr;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_STACK_SPACE_OPERAND: {
|
||||
uint32_t framesize = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t framesize = (uint32_t)CURRENT_OPERAND0();
|
||||
assert(framesize <= INT_MAX);
|
||||
if (!_PyThreadState_HasStackSpace(tstate, framesize)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
|
@ -5690,7 +5702,7 @@
|
|||
}
|
||||
|
||||
case _EXIT_TRACE: {
|
||||
PyObject *exit_p = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *exit_p = (PyObject *)CURRENT_OPERAND0();
|
||||
_PyExitData *exit = (_PyExitData *)exit_p;
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
|
@ -5757,7 +5769,7 @@
|
|||
|
||||
case _LOAD_CONST_INLINE: {
|
||||
_PyStackRef value;
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
value = PyStackRef_FromPyObjectNew(ptr);
|
||||
stack_pointer[0] = value;
|
||||
stack_pointer += 1;
|
||||
|
@ -5767,7 +5779,7 @@
|
|||
|
||||
case _LOAD_CONST_INLINE_BORROW: {
|
||||
_PyStackRef value;
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
value = PyStackRef_FromPyObjectImmortal(ptr);
|
||||
stack_pointer[0] = value;
|
||||
stack_pointer += 1;
|
||||
|
@ -5779,7 +5791,7 @@
|
|||
_PyStackRef pop;
|
||||
_PyStackRef value;
|
||||
pop = stack_pointer[-1];
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
PyStackRef_CLOSE(pop);
|
||||
value = PyStackRef_FromPyObjectImmortal(ptr);
|
||||
stack_pointer[-1] = value;
|
||||
|
@ -5789,7 +5801,7 @@
|
|||
case _LOAD_CONST_INLINE_WITH_NULL: {
|
||||
_PyStackRef value;
|
||||
_PyStackRef null;
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
value = PyStackRef_FromPyObjectNew(ptr);
|
||||
null = PyStackRef_NULL;
|
||||
stack_pointer[0] = value;
|
||||
|
@ -5802,7 +5814,7 @@
|
|||
case _LOAD_CONST_INLINE_BORROW_WITH_NULL: {
|
||||
_PyStackRef value;
|
||||
_PyStackRef null;
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
value = PyStackRef_FromPyObjectImmortal(ptr);
|
||||
null = PyStackRef_NULL;
|
||||
stack_pointer[0] = value;
|
||||
|
@ -5813,7 +5825,7 @@
|
|||
}
|
||||
|
||||
case _CHECK_FUNCTION: {
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t func_version = (uint32_t)CURRENT_OPERAND0();
|
||||
assert(PyStackRef_FunctionCheck(frame->f_funcobj));
|
||||
PyFunctionObject *func = (PyFunctionObject *)PyStackRef_AsPyObjectBorrow(frame->f_funcobj);
|
||||
if (func->func_version != func_version) {
|
||||
|
@ -5827,7 +5839,7 @@
|
|||
_PyStackRef res;
|
||||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictObject *dict = (PyDictObject *)GLOBALS();
|
||||
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(dict->ma_keys);
|
||||
PyObject *res_o = entries[index].me_value;
|
||||
|
@ -5849,7 +5861,7 @@
|
|||
_PyStackRef res;
|
||||
_PyStackRef null = PyStackRef_NULL;
|
||||
oparg = CURRENT_OPARG();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND();
|
||||
uint16_t index = (uint16_t)CURRENT_OPERAND0();
|
||||
PyDictObject *dict = (PyDictObject *)BUILTINS();
|
||||
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(dict->ma_keys);
|
||||
PyObject *res_o = entries[index].me_value;
|
||||
|
@ -5878,7 +5890,7 @@
|
|||
}
|
||||
|
||||
case _DYNAMIC_EXIT: {
|
||||
PyObject *exit_p = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *exit_p = (PyObject *)CURRENT_OPERAND0();
|
||||
tstate->previous_executor = (PyObject *)current_executor;
|
||||
_PyExitData *exit = (_PyExitData *)exit_p;
|
||||
_Py_CODEUNIT *target = frame->instr_ptr;
|
||||
|
@ -5925,7 +5937,7 @@
|
|||
}
|
||||
|
||||
case _START_EXECUTOR: {
|
||||
PyObject *executor = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *executor = (PyObject *)CURRENT_OPERAND0();
|
||||
Py_DECREF(tstate->previous_executor);
|
||||
tstate->previous_executor = NULL;
|
||||
#ifndef _Py_JIT
|
||||
|
@ -5951,7 +5963,7 @@
|
|||
}
|
||||
|
||||
case _CHECK_VALIDITY_AND_SET_IP: {
|
||||
PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND();
|
||||
PyObject *instr_ptr = (PyObject *)CURRENT_OPERAND0();
|
||||
if (!current_executor->vm_data.valid) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
|
@ -5967,7 +5979,7 @@
|
|||
|
||||
case _ERROR_POP_N: {
|
||||
oparg = CURRENT_OPARG();
|
||||
uint32_t target = (uint32_t)CURRENT_OPERAND();
|
||||
uint32_t target = (uint32_t)CURRENT_OPERAND0();
|
||||
stack_pointer += -oparg;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
|
|
2
Python/generated_cases.c.h
generated
2
Python/generated_cases.c.h
generated
|
@ -192,7 +192,7 @@
|
|||
assert(next_instr->op.code == STORE_FAST);
|
||||
next_oparg = next_instr->op.arg;
|
||||
#else
|
||||
next_oparg = CURRENT_OPERAND();
|
||||
next_oparg = CURRENT_OPERAND0();
|
||||
#endif
|
||||
_PyStackRef *target_local = &GETLOCAL(next_oparg);
|
||||
DEOPT_IF(!PyStackRef_Is(*target_local, left), BINARY_OP);
|
||||
|
|
|
@ -288,13 +288,13 @@ _PyUOpPrint(const _PyUOpInstruction *uop)
|
|||
printf(" (%d, target=%d, operand=%#" PRIx64,
|
||||
uop->oparg,
|
||||
uop->target,
|
||||
(uint64_t)uop->operand);
|
||||
(uint64_t)uop->operand0);
|
||||
break;
|
||||
case UOP_FORMAT_JUMP:
|
||||
printf(" (%d, jump_target=%d, operand=%#" PRIx64,
|
||||
uop->oparg,
|
||||
uop->jump_target,
|
||||
(uint64_t)uop->operand);
|
||||
(uint64_t)uop->operand0);
|
||||
break;
|
||||
default:
|
||||
printf(" (%d, Unknown format)", uop->oparg);
|
||||
|
@ -340,7 +340,7 @@ uop_item(_PyExecutorObject *self, Py_ssize_t index)
|
|||
Py_DECREF(oname);
|
||||
return NULL;
|
||||
}
|
||||
PyObject *operand = PyLong_FromUnsignedLongLong(self->trace[index].operand);
|
||||
PyObject *operand = PyLong_FromUnsignedLongLong(self->trace[index].operand0);
|
||||
if (operand == NULL) {
|
||||
Py_DECREF(target);
|
||||
Py_DECREF(oparg);
|
||||
|
@ -463,7 +463,7 @@ add_to_trace(
|
|||
trace[trace_length].format = UOP_FORMAT_TARGET;
|
||||
trace[trace_length].target = target;
|
||||
trace[trace_length].oparg = oparg;
|
||||
trace[trace_length].operand = operand;
|
||||
trace[trace_length].operand0 = operand;
|
||||
return trace_length + 1;
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@ static void make_exit(_PyUOpInstruction *inst, int opcode, int target)
|
|||
{
|
||||
inst->opcode = opcode;
|
||||
inst->oparg = 0;
|
||||
inst->operand = 0;
|
||||
inst->operand0 = 0;
|
||||
inst->format = UOP_FORMAT_TARGET;
|
||||
inst->target = target;
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ prepare_for_execution(_PyUOpInstruction *buffer, int length)
|
|||
current_error_target = target;
|
||||
make_exit(&buffer[next_spare], _ERROR_POP_N, 0);
|
||||
buffer[next_spare].oparg = popped;
|
||||
buffer[next_spare].operand = target;
|
||||
buffer[next_spare].operand0 = target;
|
||||
next_spare++;
|
||||
}
|
||||
buffer[i].error_target = current_error;
|
||||
|
@ -1150,7 +1150,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
|
|||
int next_exit = exit_count-1;
|
||||
_PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length];
|
||||
assert(buffer[0].opcode == _START_EXECUTOR);
|
||||
buffer[0].operand = (uint64_t)executor;
|
||||
buffer[0].operand0 = (uint64_t)executor;
|
||||
for (int i = length-1; i >= 0; i--) {
|
||||
int opcode = buffer[i].opcode;
|
||||
dest--;
|
||||
|
@ -1159,13 +1159,13 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
|
|||
if (opcode == _EXIT_TRACE) {
|
||||
_PyExitData *exit = &executor->exits[next_exit];
|
||||
exit->target = buffer[i].target;
|
||||
dest->operand = (uint64_t)exit;
|
||||
dest->operand0 = (uint64_t)exit;
|
||||
next_exit--;
|
||||
}
|
||||
if (opcode == _DYNAMIC_EXIT) {
|
||||
_PyExitData *exit = &executor->exits[next_exit];
|
||||
exit->target = 0;
|
||||
dest->operand = (uint64_t)exit;
|
||||
dest->operand0 = (uint64_t)exit;
|
||||
next_exit--;
|
||||
}
|
||||
}
|
||||
|
@ -1312,7 +1312,7 @@ _PyOptimizer_NewUOpOptimizer(void)
|
|||
static void
|
||||
counter_dealloc(_PyExecutorObject *self) {
|
||||
/* The optimizer is the operand of the second uop. */
|
||||
PyObject *opt = (PyObject *)self->trace[1].operand;
|
||||
PyObject *opt = (PyObject *)self->trace[1].operand0;
|
||||
Py_DECREF(opt);
|
||||
uop_dealloc(self);
|
||||
}
|
||||
|
@ -1352,7 +1352,7 @@ counter_optimize(
|
|||
_Py_CODEUNIT *target = instr + 1 + _PyOpcode_Caches[JUMP_BACKWARD] - oparg;
|
||||
_PyUOpInstruction buffer[4] = {
|
||||
{ .opcode = _START_EXECUTOR, .jump_target = 3, .format=UOP_FORMAT_JUMP },
|
||||
{ .opcode = _LOAD_CONST_INLINE, .operand = (uintptr_t)self },
|
||||
{ .opcode = _LOAD_CONST_INLINE, .operand0 = (uintptr_t)self },
|
||||
{ .opcode = _INTERNAL_INCREMENT_OPT_COUNTER },
|
||||
{ .opcode = _EXIT_TRACE, .target = (uint32_t)(target - _PyCode_CODE(code)), .format=UOP_FORMAT_TARGET }
|
||||
};
|
||||
|
|
|
@ -100,11 +100,11 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj)
|
|||
PyDictObject *dict = (PyDictObject *)obj;
|
||||
assert(dict->ma_keys->dk_kind == DICT_KEYS_UNICODE);
|
||||
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(dict->ma_keys);
|
||||
assert(inst->operand <= UINT16_MAX);
|
||||
if ((int)inst->operand >= dict->ma_keys->dk_nentries) {
|
||||
assert(inst->operand0 <= UINT16_MAX);
|
||||
if ((int)inst->operand0 >= dict->ma_keys->dk_nentries) {
|
||||
return NULL;
|
||||
}
|
||||
PyObject *res = entries[inst->operand].me_value;
|
||||
PyObject *res = entries[inst->operand0].me_value;
|
||||
if (res == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj)
|
|||
else {
|
||||
inst->opcode = (inst->oparg & 1) ? _LOAD_CONST_INLINE_WITH_NULL : _LOAD_CONST_INLINE;
|
||||
}
|
||||
inst->operand = (uint64_t)res;
|
||||
inst->operand0 = (uint64_t)res;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ incorrect_keys(_PyUOpInstruction *inst, PyObject *obj)
|
|||
return 1;
|
||||
}
|
||||
PyDictObject *dict = (PyDictObject *)obj;
|
||||
if (dict->ma_keys->dk_version != inst->operand) {
|
||||
if (dict->ma_keys->dk_version != inst->operand0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -215,7 +215,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
}
|
||||
else {
|
||||
buffer[pc].opcode = _CHECK_FUNCTION;
|
||||
buffer[pc].operand = function_version;
|
||||
buffer[pc].operand0 = function_version;
|
||||
function_checked |= 1;
|
||||
}
|
||||
// We're no longer pushing the builtins keys; rewrite the
|
||||
|
@ -248,7 +248,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
}
|
||||
else {
|
||||
buffer[pc].opcode = _CHECK_FUNCTION;
|
||||
buffer[pc].operand = function_version;
|
||||
buffer[pc].operand0 = function_version;
|
||||
function_checked |= 1;
|
||||
}
|
||||
if (opcode == _GUARD_GLOBALS_VERSION_PUSH_KEYS) {
|
||||
|
@ -273,7 +273,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
builtins_watched <<= 1;
|
||||
globals_watched <<= 1;
|
||||
function_checked <<= 1;
|
||||
uint64_t operand = buffer[pc].operand;
|
||||
uint64_t operand = buffer[pc].operand0;
|
||||
if (operand == 0 || (operand & 1)) {
|
||||
// It's either a code object or NULL, so bail
|
||||
return 1;
|
||||
|
@ -301,7 +301,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
builtins_watched >>= 1;
|
||||
globals_watched >>= 1;
|
||||
function_checked >>= 1;
|
||||
uint64_t operand = buffer[pc].operand;
|
||||
uint64_t operand = buffer[pc].operand0;
|
||||
if (operand == 0 || (operand & 1)) {
|
||||
// It's either a code object or NULL, so bail
|
||||
return 1;
|
||||
|
@ -317,7 +317,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
break;
|
||||
}
|
||||
case _CHECK_FUNCTION_EXACT_ARGS:
|
||||
prechecked_function_version = (uint32_t)buffer[pc].operand;
|
||||
prechecked_function_version = (uint32_t)buffer[pc].operand0;
|
||||
break;
|
||||
default:
|
||||
if (is_terminator(inst)) {
|
||||
|
@ -343,7 +343,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
#define REPLACE_OP(INST, OP, ARG, OPERAND) \
|
||||
INST->opcode = OP; \
|
||||
INST->oparg = ARG; \
|
||||
INST->operand = OPERAND;
|
||||
INST->operand0 = OPERAND;
|
||||
|
||||
/* Shortened forms for convenience, used in optimizer_bytecodes.c */
|
||||
#define sym_is_not_null _Py_uop_sym_is_not_null
|
||||
|
@ -409,7 +409,7 @@ get_code(_PyUOpInstruction *op)
|
|||
{
|
||||
assert(op->opcode == _PUSH_FRAME || op->opcode == _RETURN_VALUE || op->opcode == _RETURN_GENERATOR);
|
||||
PyCodeObject *co = NULL;
|
||||
uint64_t operand = op->operand;
|
||||
uint64_t operand = op->operand0;
|
||||
if (operand == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ static PyCodeObject *
|
|||
get_code_with_logging(_PyUOpInstruction *op)
|
||||
{
|
||||
PyCodeObject *co = NULL;
|
||||
uint64_t push_operand = op->operand;
|
||||
uint64_t push_operand = op->operand0;
|
||||
if (push_operand & 1) {
|
||||
co = (PyCodeObject *)(push_operand & ~1);
|
||||
DPRINTF(3, "code=%p ", co);
|
||||
|
@ -534,7 +534,7 @@ optimize_uops(
|
|||
assert(max_space <= INT_MAX);
|
||||
assert(max_space <= INT32_MAX);
|
||||
first_valid_check_stack->opcode = _CHECK_STACK_SPACE_OPERAND;
|
||||
first_valid_check_stack->operand = max_space;
|
||||
first_valid_check_stack->operand0 = max_space;
|
||||
}
|
||||
return trace_len;
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ dummy_func(void) {
|
|||
res = sym_new_type(ctx, &PyUnicode_Type);
|
||||
}
|
||||
// _STORE_FAST:
|
||||
GETLOCAL(this_instr->operand) = res;
|
||||
GETLOCAL(this_instr->operand0) = res;
|
||||
}
|
||||
|
||||
op(_BINARY_SUBSCR_INIT_CALL, (container, sub -- new_frame: _Py_UOpsAbstractFrame *)) {
|
||||
|
@ -589,8 +589,27 @@ dummy_func(void) {
|
|||
self = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_CHECK_FUNCTION_EXACT_ARGS, (callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
|
||||
op(_CHECK_FUNCTION_VERSION, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
|
||||
(void)self_or_null;
|
||||
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
||||
assert(PyFunction_Check(sym_get_const(callable)));
|
||||
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
||||
this_instr->operand1 = (uintptr_t)sym_get_const(callable);
|
||||
}
|
||||
sym_set_type(callable, &PyFunction_Type);
|
||||
}
|
||||
|
||||
op(_CHECK_FUNCTION_EXACT_ARGS, (callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
|
||||
assert(sym_matches_type(callable, &PyFunction_Type));
|
||||
if (sym_is_const(callable)) {
|
||||
if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) {
|
||||
PyFunctionObject *func = (PyFunctionObject *)sym_get_const(callable);
|
||||
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
||||
if (co->co_argcount == oparg + !sym_is_null(self_or_null)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0 ,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)self_or_null;
|
||||
}
|
||||
|
||||
|
|
69
Python/optimizer_cases.c.h
generated
69
Python/optimizer_cases.c.h
generated
|
@ -525,7 +525,7 @@
|
|||
res = sym_new_type(ctx, &PyUnicode_Type);
|
||||
}
|
||||
// _STORE_FAST:
|
||||
GETLOCAL(this_instr->operand) = res;
|
||||
GETLOCAL(this_instr->operand0) = res;
|
||||
stack_pointer += -2;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
break;
|
||||
|
@ -888,7 +888,7 @@
|
|||
|
||||
case _GUARD_GLOBALS_VERSION_PUSH_KEYS: {
|
||||
_Py_UopsSymbol *globals_keys;
|
||||
uint16_t version = (uint16_t)this_instr->operand;
|
||||
uint16_t version = (uint16_t)this_instr->operand0;
|
||||
globals_keys = sym_new_unknown(ctx);
|
||||
(void)version;
|
||||
stack_pointer[0] = globals_keys;
|
||||
|
@ -899,7 +899,7 @@
|
|||
|
||||
case _GUARD_BUILTINS_VERSION_PUSH_KEYS: {
|
||||
_Py_UopsSymbol *builtins_keys;
|
||||
uint16_t version = (uint16_t)this_instr->operand;
|
||||
uint16_t version = (uint16_t)this_instr->operand0;
|
||||
builtins_keys = sym_new_unknown(ctx);
|
||||
(void)version;
|
||||
stack_pointer[0] = builtins_keys;
|
||||
|
@ -1090,7 +1090,7 @@
|
|||
case _GUARD_TYPE_VERSION: {
|
||||
_Py_UopsSymbol *owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t type_version = (uint32_t)this_instr->operand;
|
||||
uint32_t type_version = (uint32_t)this_instr->operand0;
|
||||
assert(type_version);
|
||||
if (sym_matches_type_version(owner, type_version)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0, 0);
|
||||
|
@ -1122,7 +1122,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *null = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t offset = (uint16_t)this_instr->operand;
|
||||
uint16_t offset = (uint16_t)this_instr->operand0;
|
||||
attr = sym_new_not_null(ctx);
|
||||
null = sym_new_null(ctx);
|
||||
(void)offset;
|
||||
|
@ -1137,7 +1137,7 @@
|
|||
case _CHECK_ATTR_MODULE: {
|
||||
_Py_UopsSymbol *owner;
|
||||
owner = stack_pointer[-1];
|
||||
uint32_t dict_version = (uint32_t)this_instr->operand;
|
||||
uint32_t dict_version = (uint32_t)this_instr->operand0;
|
||||
(void)dict_version;
|
||||
if (sym_is_const(owner)) {
|
||||
PyObject *cnst = sym_get_const(owner);
|
||||
|
@ -1160,7 +1160,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *null = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t index = (uint16_t)this_instr->operand;
|
||||
uint16_t index = (uint16_t)this_instr->operand0;
|
||||
(void)index;
|
||||
null = sym_new_null(ctx);
|
||||
attr = NULL;
|
||||
|
@ -1202,7 +1202,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *null = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t hint = (uint16_t)this_instr->operand;
|
||||
uint16_t hint = (uint16_t)this_instr->operand0;
|
||||
attr = sym_new_not_null(ctx);
|
||||
null = sym_new_null(ctx);
|
||||
(void)hint;
|
||||
|
@ -1219,7 +1219,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *null = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
uint16_t index = (uint16_t)this_instr->operand;
|
||||
uint16_t index = (uint16_t)this_instr->operand0;
|
||||
attr = sym_new_not_null(ctx);
|
||||
null = sym_new_null(ctx);
|
||||
(void)index;
|
||||
|
@ -1240,7 +1240,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *null = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)this_instr->operand;
|
||||
PyObject *descr = (PyObject *)this_instr->operand0;
|
||||
attr = sym_new_not_null(ctx);
|
||||
null = sym_new_null(ctx);
|
||||
(void)descr;
|
||||
|
@ -1256,7 +1256,7 @@
|
|||
_Py_UopsSymbol *owner;
|
||||
_Py_UOpsAbstractFrame *new_frame;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *fget = (PyObject *)this_instr->operand;
|
||||
PyObject *fget = (PyObject *)this_instr->operand0;
|
||||
(void)fget;
|
||||
(void)owner;
|
||||
new_frame = NULL;
|
||||
|
@ -1639,7 +1639,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *self = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)this_instr->operand;
|
||||
PyObject *descr = (PyObject *)this_instr->operand0;
|
||||
(void)descr;
|
||||
attr = sym_new_not_null(ctx);
|
||||
self = owner;
|
||||
|
@ -1655,7 +1655,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *self = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)this_instr->operand;
|
||||
PyObject *descr = (PyObject *)this_instr->operand0;
|
||||
(void)descr;
|
||||
attr = sym_new_not_null(ctx);
|
||||
self = owner;
|
||||
|
@ -1689,7 +1689,7 @@
|
|||
_Py_UopsSymbol *attr;
|
||||
_Py_UopsSymbol *self = NULL;
|
||||
owner = stack_pointer[-1];
|
||||
PyObject *descr = (PyObject *)this_instr->operand;
|
||||
PyObject *descr = (PyObject *)this_instr->operand0;
|
||||
(void)descr;
|
||||
attr = sym_new_not_null(ctx);
|
||||
self = owner;
|
||||
|
@ -1749,6 +1749,22 @@
|
|||
}
|
||||
|
||||
case _CHECK_FUNCTION_VERSION: {
|
||||
_Py_UopsSymbol *self_or_null;
|
||||
_Py_UopsSymbol *callable;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
uint32_t func_version = (uint32_t)this_instr->operand0;
|
||||
(void)self_or_null;
|
||||
if (sym_is_const(callable) && sym_matches_type(callable, &PyFunction_Type)) {
|
||||
assert(PyFunction_Check(sym_get_const(callable)));
|
||||
REPLACE_OP(this_instr, _CHECK_FUNCTION_VERSION_INLINE, 0, func_version);
|
||||
this_instr->operand1 = (uintptr_t)sym_get_const(callable);
|
||||
}
|
||||
sym_set_type(callable, &PyFunction_Type);
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_FUNCTION_VERSION_INLINE: {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1832,16 @@
|
|||
_Py_UopsSymbol *callable;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
sym_set_type(callable, &PyFunction_Type);
|
||||
assert(sym_matches_type(callable, &PyFunction_Type));
|
||||
if (sym_is_const(callable)) {
|
||||
if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) {
|
||||
PyFunctionObject *func = (PyFunctionObject *)sym_get_const(callable);
|
||||
PyCodeObject *co = (PyCodeObject *)func->func_code;
|
||||
if (co->co_argcount == oparg + !sym_is_null(self_or_null)) {
|
||||
REPLACE_OP(this_instr, _NOP, 0 ,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
(void)self_or_null;
|
||||
break;
|
||||
}
|
||||
|
@ -1939,7 +1964,7 @@
|
|||
null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
args = &stack_pointer[-oparg];
|
||||
uint32_t type_version = (uint32_t)this_instr->operand;
|
||||
uint32_t type_version = (uint32_t)this_instr->operand0;
|
||||
(void)type_version;
|
||||
(void)callable;
|
||||
(void)null;
|
||||
|
@ -2399,7 +2424,7 @@
|
|||
}
|
||||
|
||||
case _CHECK_STACK_SPACE_OPERAND: {
|
||||
uint32_t framesize = (uint32_t)this_instr->operand;
|
||||
uint32_t framesize = (uint32_t)this_instr->operand0;
|
||||
(void)framesize;
|
||||
/* We should never see _CHECK_STACK_SPACE_OPERANDs.
|
||||
* They are only created at the end of this pass. */
|
||||
|
@ -2412,7 +2437,7 @@
|
|||
}
|
||||
|
||||
case _EXIT_TRACE: {
|
||||
PyObject *exit_p = (PyObject *)this_instr->operand;
|
||||
PyObject *exit_p = (PyObject *)this_instr->operand0;
|
||||
(void)exit_p;
|
||||
ctx->done = true;
|
||||
break;
|
||||
|
@ -2424,7 +2449,7 @@
|
|||
|
||||
case _LOAD_CONST_INLINE: {
|
||||
_Py_UopsSymbol *value;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand0;
|
||||
value = sym_new_const(ctx, ptr);
|
||||
stack_pointer[0] = value;
|
||||
stack_pointer += 1;
|
||||
|
@ -2434,7 +2459,7 @@
|
|||
|
||||
case _LOAD_CONST_INLINE_BORROW: {
|
||||
_Py_UopsSymbol *value;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand0;
|
||||
value = sym_new_const(ctx, ptr);
|
||||
stack_pointer[0] = value;
|
||||
stack_pointer += 1;
|
||||
|
@ -2452,7 +2477,7 @@
|
|||
case _LOAD_CONST_INLINE_WITH_NULL: {
|
||||
_Py_UopsSymbol *value;
|
||||
_Py_UopsSymbol *null;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand0;
|
||||
value = sym_new_const(ctx, ptr);
|
||||
null = sym_new_null(ctx);
|
||||
stack_pointer[0] = value;
|
||||
|
@ -2465,7 +2490,7 @@
|
|||
case _LOAD_CONST_INLINE_BORROW_WITH_NULL: {
|
||||
_Py_UopsSymbol *value;
|
||||
_Py_UopsSymbol *null;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand;
|
||||
PyObject *ptr = (PyObject *)this_instr->operand0;
|
||||
value = sym_new_const(ctx, ptr);
|
||||
null = sym_new_null(ctx);
|
||||
stack_pointer[0] = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue