mirror of
https://github.com/python/cpython.git
synced 2026-04-16 00:31:03 +00:00
gh-131798: JIT inline function addresses of builtin methods (#146906)
This commit is contained in:
parent
b8470deb5d
commit
7e275d4965
11 changed files with 1724 additions and 1282 deletions
|
|
@ -4813,13 +4813,11 @@ dummy_func(
|
|||
}
|
||||
// CPython promises to check all non-vectorcall function calls.
|
||||
EXIT_IF(_Py_ReachedRecursionLimit(tstate));
|
||||
_PyStackRef arg_stackref = arguments[1];
|
||||
_PyStackRef self_stackref = arguments[0];
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc,
|
||||
PyStackRef_AsPyObjectBorrow(self_stackref),
|
||||
PyStackRef_AsPyObjectBorrow(arg_stackref));
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(arguments[1]);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc, self, arg);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
if (res_o == NULL) {
|
||||
|
|
@ -4832,6 +4830,26 @@ dummy_func(
|
|||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_O_INLINE, (callable, args[oparg], cfunc/4 -- res, c, s, a)) {
|
||||
assert(oparg == 2);
|
||||
EXIT_IF(_Py_ReachedRecursionLimit(tstate));
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunction cfunc_v = (PyCFunction)cfunc;
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(args[1]);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc_v, self, arg);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
c = callable;
|
||||
s = args[0];
|
||||
a = args[1];
|
||||
INPUTS_DEAD();
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_O) =
|
||||
_RECORD_CALLABLE +
|
||||
unused/1 +
|
||||
|
|
@ -4872,9 +4890,10 @@ dummy_func(
|
|||
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -4886,6 +4905,24 @@ dummy_func(
|
|||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunctionFastWithKeywords cfunc_v = _PyCFunctionFastWithKeywords_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) =
|
||||
_RECORD_CALLABLE +
|
||||
unused/1 +
|
||||
|
|
@ -4934,6 +4971,23 @@ dummy_func(
|
|||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
|
||||
assert(oparg == 1);
|
||||
_PyStackRef self_stackref = args[0];
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_stackref);
|
||||
EXIT_IF(_Py_ReachedRecursionLimit(tstate));
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunction cfunc_v = (PyCFunction)cfunc;
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc_v, self, NULL);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
PyStackRef_CLOSE(self_stackref);
|
||||
DEAD(args);
|
||||
PyStackRef_CLOSE(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_NOARGS) =
|
||||
_RECORD_CALLABLE +
|
||||
unused/1 +
|
||||
|
|
@ -4971,9 +5025,10 @@ dummy_func(
|
|||
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -4985,6 +5040,24 @@ dummy_func(
|
|||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunctionFast cfunc_v = _PyCFunctionFast_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_FAST) =
|
||||
unused/1 +
|
||||
unused/2 +
|
||||
|
|
|
|||
|
|
@ -874,7 +874,7 @@ _Py_BuiltinCallFastWithKeywords_StackRefSteal(
|
|||
PyObject *
|
||||
_PyCallMethodDescriptorFast_StackRefSteal(
|
||||
_PyStackRef callable,
|
||||
PyMethodDef *meth,
|
||||
PyCFunctionFast cfunc,
|
||||
PyObject *self,
|
||||
_PyStackRef *arguments,
|
||||
int total_args)
|
||||
|
|
@ -885,10 +885,8 @@ _PyCallMethodDescriptorFast_StackRefSteal(
|
|||
res = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
assert(((PyMethodDescrObject *)PyStackRef_AsPyObjectBorrow(callable))->d_method == meth);
|
||||
assert(self == PyStackRef_AsPyObjectBorrow(arguments[0]));
|
||||
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(meth->ml_meth);
|
||||
res = cfunc(self, (args_o + 1), total_args - 1);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
|
||||
|
|
@ -907,7 +905,7 @@ _PyCallMethodDescriptorFast_StackRefSteal(
|
|||
PyObject *
|
||||
_PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
_PyStackRef callable,
|
||||
PyMethodDef *meth,
|
||||
PyCFunctionFastWithKeywords cfunc,
|
||||
PyObject *self,
|
||||
_PyStackRef *arguments,
|
||||
int total_args)
|
||||
|
|
@ -918,11 +916,8 @@ _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
|||
res = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
assert(((PyMethodDescrObject *)PyStackRef_AsPyObjectBorrow(callable))->d_method == meth);
|
||||
assert(self == PyStackRef_AsPyObjectBorrow(arguments[0]));
|
||||
|
||||
PyCFunctionFastWithKeywords cfunc =
|
||||
_PyCFunctionFastWithKeywords_CAST(meth->ml_meth);
|
||||
res = cfunc(self, (args_o + 1), total_args-1, NULL);
|
||||
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
|
||||
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
|
||||
|
|
|
|||
187
Python/executor_cases.c.h
generated
187
Python/executor_cases.c.h
generated
|
|
@ -17091,14 +17091,12 @@
|
|||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
_PyStackRef arg_stackref = arguments[1];
|
||||
_PyStackRef self_stackref = arguments[0];
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(arguments[1]);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc,
|
||||
PyStackRef_AsPyObjectBorrow(self_stackref),
|
||||
PyStackRef_AsPyObjectBorrow(arg_stackref));
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc, self, arg);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
|
@ -17121,6 +17119,53 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_O_INLINE_r03: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef *args;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
_PyStackRef c;
|
||||
_PyStackRef s;
|
||||
_PyStackRef a;
|
||||
oparg = CURRENT_OPARG();
|
||||
args = &stack_pointer[-oparg];
|
||||
callable = stack_pointer[-1 - oparg];
|
||||
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
|
||||
assert(oparg == 2);
|
||||
if (_Py_ReachedRecursionLimit(tstate)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunction cfunc_v = (PyCFunction)cfunc;
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(args[1]);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc_v, self, arg);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
if (res_o == NULL) {
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
c = callable;
|
||||
s = args[0];
|
||||
a = args[1];
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
_tos_cache2 = a;
|
||||
_tos_cache1 = s;
|
||||
_tos_cache0 = c;
|
||||
SET_CURRENT_CACHED_VALUES(3);
|
||||
stack_pointer[-1 - oparg] = res;
|
||||
stack_pointer += -oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r00: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
|
|
@ -17188,9 +17233,10 @@
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -17213,6 +17259,46 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE_r01: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef *args;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
oparg = CURRENT_OPARG();
|
||||
args = &stack_pointer[-oparg];
|
||||
callable = stack_pointer[-1 - oparg];
|
||||
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
volatile PyCFunctionFastWithKeywords cfunc_v = _PyCFunctionFastWithKeywords_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (res_o == NULL) {
|
||||
stack_pointer += -1 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
_tos_cache0 = res;
|
||||
_tos_cache1 = PyStackRef_ZERO_BITS;
|
||||
_tos_cache2 = PyStackRef_ZERO_BITS;
|
||||
SET_CURRENT_CACHED_VALUES(1);
|
||||
stack_pointer += -1 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS_r00: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
|
|
@ -17308,6 +17394,52 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_NOARGS_INLINE_r01: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef *args;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
oparg = CURRENT_OPARG();
|
||||
args = &stack_pointer[-oparg];
|
||||
callable = stack_pointer[-1 - oparg];
|
||||
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
|
||||
assert(oparg == 1);
|
||||
_PyStackRef self_stackref = args[0];
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_stackref);
|
||||
if (_Py_ReachedRecursionLimit(tstate)) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunction cfunc_v = (PyCFunction)cfunc;
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc_v, self, NULL);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(self_stackref);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
stack_pointer += -1 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(callable);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (res_o == NULL) {
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
_tos_cache0 = res;
|
||||
_tos_cache1 = PyStackRef_ZERO_BITS;
|
||||
_tos_cache2 = PyStackRef_ZERO_BITS;
|
||||
SET_CURRENT_CACHED_VALUES(1);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_r00: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
|
|
@ -17374,9 +17506,10 @@
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -17399,6 +17532,46 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST_INLINE_r01: {
|
||||
CHECK_CURRENT_CACHED_VALUES(0);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
_PyStackRef *args;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
oparg = CURRENT_OPARG();
|
||||
args = &stack_pointer[-oparg];
|
||||
callable = stack_pointer[-1 - oparg];
|
||||
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
volatile PyCFunctionFast cfunc_v = _PyCFunctionFast_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (res_o == NULL) {
|
||||
stack_pointer += -1 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
_tos_cache0 = res;
|
||||
_tos_cache1 = PyStackRef_ZERO_BITS;
|
||||
_tos_cache2 = PyStackRef_ZERO_BITS;
|
||||
SET_CURRENT_CACHED_VALUES(1);
|
||||
stack_pointer += -1 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
|
||||
break;
|
||||
}
|
||||
|
||||
/* _MONITOR_CALL_KW is not a viable micro-op for tier 2 because it uses the 'this_instr' variable */
|
||||
|
||||
case _MAYBE_EXPAND_METHOD_KW_r11: {
|
||||
|
|
|
|||
14
Python/generated_cases.c.h
generated
14
Python/generated_cases.c.h
generated
|
|
@ -3827,9 +3827,10 @@
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -3923,9 +3924,10 @@
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
callable,
|
||||
method->d_method,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
|
|
@ -4122,14 +4124,12 @@
|
|||
assert(_PyOpcode_Deopt[opcode] == (CALL));
|
||||
JUMP_TO_PREDICTED(CALL);
|
||||
}
|
||||
_PyStackRef arg_stackref = arguments[1];
|
||||
_PyStackRef self_stackref = arguments[0];
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(arguments[0]);
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(arguments[1]);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc,
|
||||
PyStackRef_AsPyObjectBorrow(self_stackref),
|
||||
PyStackRef_AsPyObjectBorrow(arg_stackref));
|
||||
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc, self, arg);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
|
|
|||
|
|
@ -1394,6 +1394,39 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && sym_matches_type(callable, &PyMethodDescr_Type)) {
|
||||
|
|
@ -1420,6 +1453,13 @@ dummy_func(void) {
|
|||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_O_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
c = callable;
|
||||
if (sym_is_not_null(self_or_null)) {
|
||||
|
|
|
|||
89
Python/optimizer_cases.c.h
generated
89
Python/optimizer_cases.c.h
generated
|
|
@ -4107,6 +4107,13 @@
|
|||
args = &stack_pointer[-oparg];
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_O_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
c = callable;
|
||||
if (sym_is_not_null(self_or_null)) {
|
||||
|
|
@ -4128,6 +4135,25 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_O_INLINE: {
|
||||
JitOptRef res;
|
||||
JitOptRef c;
|
||||
JitOptRef s;
|
||||
JitOptRef a;
|
||||
res = sym_new_not_null(ctx);
|
||||
c = sym_new_not_null(ctx);
|
||||
s = sym_new_not_null(ctx);
|
||||
a = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(3 - oparg);
|
||||
stack_pointer[-1 - oparg] = res;
|
||||
stack_pointer[-oparg] = c;
|
||||
stack_pointer[1 - oparg] = s;
|
||||
stack_pointer[2 - oparg] = a;
|
||||
stack_pointer += 3 - oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: {
|
||||
JitOptRef *args;
|
||||
JitOptRef self_or_null;
|
||||
|
|
@ -4161,7 +4187,18 @@
|
|||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: {
|
||||
JitOptRef self_or_null;
|
||||
JitOptRef callable;
|
||||
JitOptRef res;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-1 - oparg);
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
|
|
@ -4170,6 +4207,16 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE: {
|
||||
JitOptRef res;
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-oparg);
|
||||
stack_pointer[-1 - oparg] = res;
|
||||
stack_pointer += -oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS: {
|
||||
JitOptRef *args;
|
||||
JitOptRef self_or_null;
|
||||
|
|
@ -4203,7 +4250,18 @@
|
|||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_NOARGS: {
|
||||
JitOptRef self_or_null;
|
||||
JitOptRef callable;
|
||||
JitOptRef res;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-1 - oparg);
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
|
|
@ -4212,6 +4270,16 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_NOARGS_INLINE: {
|
||||
JitOptRef res;
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-oparg);
|
||||
stack_pointer[-1 - oparg] = res;
|
||||
stack_pointer += -oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
case _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST: {
|
||||
JitOptRef *args;
|
||||
JitOptRef self_or_null;
|
||||
|
|
@ -4245,7 +4313,18 @@
|
|||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST: {
|
||||
JitOptRef self_or_null;
|
||||
JitOptRef callable;
|
||||
JitOptRef res;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-1 - oparg);
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
|
|
@ -4254,6 +4333,16 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_METHOD_DESCRIPTOR_FAST_INLINE: {
|
||||
JitOptRef res;
|
||||
res = sym_new_not_null(ctx);
|
||||
CHECK_STACK_BOUNDS(-oparg);
|
||||
stack_pointer[-1 - oparg] = res;
|
||||
stack_pointer += -oparg;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
/* _MONITOR_CALL_KW is not a viable micro-op for tier 2 */
|
||||
|
||||
case _MAYBE_EXPAND_METHOD_KW: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue