gh-148171: convert more variadic uops to leave input on stack in JIT (#148361)

This commit is contained in:
Kumar Aditya 2026-04-11 10:29:38 +05:30 committed by GitHub
parent dd88e77fad
commit 2b439da972
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 232 additions and 200 deletions

View file

@ -4907,7 +4907,7 @@ dummy_func(
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
}
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
@ -4921,36 +4921,38 @@ dummy_func(
assert(self != NULL);
STAT_INC(CALL, hit);
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
callable,
cfunc,
self,
arguments,
total_args
);
DEAD(args);
DEAD(self_or_null);
DEAD(callable);
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
if (res_o == NULL) {
ERROR_NO_POP();
}
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
PyStackRef_CLOSE(temp);
}
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
assert(self != NULL);
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, (callable, self_st, args[oparg], cfunc/4 -- callable, self_st, args[oparg])) {
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
STAT_INC(CALL, hit);
volatile PyCFunctionFastWithKeywords cfunc_v = _PyCFunctionFastWithKeywords_CAST(cfunc);
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
callable,
cfunc_v,
self,
args,
oparg
args - 1,
oparg + 1
);
DEAD(args);
DEAD(callable);
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
if (res_o == NULL) {
ERROR_NO_POP();
}
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
PyStackRef_CLOSE(temp);
}
macro(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) =
@ -4959,6 +4961,8 @@ dummy_func(
unused/2 +
_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS +
_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS +
_POP_TOP_OPARG +
POP_TOP +
_CHECK_PERIODIC_AT_END;
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
@ -5045,7 +5049,7 @@ dummy_func(
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
}
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
@ -5059,36 +5063,39 @@ dummy_func(
assert(self != NULL);
STAT_INC(CALL, hit);
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
callable,
cfunc,
self,
arguments,
total_args
);
DEAD(args);
DEAD(self_or_null);
DEAD(callable);
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
if (res_o == NULL) {
ERROR_NO_POP();
}
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
PyStackRef_CLOSE(temp);
}
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, (callable, self_st, args[oparg], cfunc/4 -- callable, self_st, args[oparg])) {
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
assert(self != NULL);
STAT_INC(CALL, hit);
volatile PyCFunctionFast cfunc_v = _PyCFunctionFast_CAST(cfunc);
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
callable,
cfunc_v,
self,
args,
oparg
args - 1,
oparg + 1
);
DEAD(args);
DEAD(callable);
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
if (res_o == NULL) {
ERROR_NO_POP();
}
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
PyStackRef_CLOSE(temp);
}
macro(CALL_METHOD_DESCRIPTOR_FAST) =
@ -5096,6 +5103,8 @@ dummy_func(
unused/2 +
_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST +
_CALL_METHOD_DESCRIPTOR_FAST +
_POP_TOP_OPARG +
POP_TOP +
_CHECK_PERIODIC_AT_END;
// Cache layout: counter/1, func_version/2

View file

@ -862,7 +862,7 @@ _Py_BuiltinCallFastWithKeywords_StackRefSteal(
}
PyObject *
_PyCallMethodDescriptorFast_StackRefSteal(
_PyCallMethodDescriptorFast_StackRef(
_PyStackRef callable,
PyCFunctionFast cfunc,
PyObject *self,
@ -872,28 +872,18 @@ _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res;
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
if (CONVERSION_FAILED(args_o)) {
res = NULL;
goto cleanup;
return NULL;
}
assert(self == PyStackRef_AsPyObjectBorrow(arguments[0]));
res = cfunc(self, (args_o + 1), total_args - 1);
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
cleanup:
// arguments is a pointer into the GC visible stack,
// so we must NULL out values as we clear them.
for (int i = total_args-1; i >= 0; i--) {
_PyStackRef tmp = arguments[i];
arguments[i] = PyStackRef_NULL;
PyStackRef_CLOSE(tmp);
}
PyStackRef_CLOSE(callable);
return res;
}
PyObject *
_PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
_PyCallMethodDescriptorFastWithKeywords_StackRef(
_PyStackRef callable,
PyCFunctionFastWithKeywords cfunc,
PyObject *self,
@ -903,23 +893,13 @@ _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res;
STACKREFS_TO_PYOBJECTS(arguments, total_args, args_o);
if (CONVERSION_FAILED(args_o)) {
res = NULL;
goto cleanup;
return NULL;
}
assert(self == PyStackRef_AsPyObjectBorrow(arguments[0]));
res = cfunc(self, (args_o + 1), total_args-1, NULL);
STACKREFS_TO_PYOBJECTS_CLEANUP(args_o);
assert((res != NULL) ^ (PyErr_Occurred() != NULL));
cleanup:
// arguments is a pointer into the GC visible stack,
// so we must NULL out values as we clear them.
for (int i = total_args-1; i >= 0; i--) {
_PyStackRef tmp = arguments[i];
arguments[i] = PyStackRef_NULL;
PyStackRef_CLOSE(tmp);
}
PyStackRef_CLOSE(callable);
return res;
}

View file

@ -17540,13 +17540,12 @@
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r01: {
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_r00: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_or_null;
_PyStackRef callable;
_PyStackRef res;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
@ -17564,7 +17563,7 @@
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
callable,
cfunc,
self,
@ -17573,58 +17572,60 @@
);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache0 = res;
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
_tos_cache0 = PyStackRef_ZERO_BITS;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE_r01: {
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE_r00: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_st;
_PyStackRef callable;
_PyStackRef res;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
callable = stack_pointer[-1 - oparg];
self_st = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
assert(self != NULL);
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
volatile PyCFunctionFastWithKeywords cfunc_v = _PyCFunctionFastWithKeywords_CAST(cfunc);
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
callable,
cfunc_v,
self,
args,
oparg
args - 1,
oparg + 1
);
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;
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
_tos_cache0 = PyStackRef_ZERO_BITS;
_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__);
SET_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}
@ -17799,13 +17800,12 @@
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST_r01: {
case _CALL_METHOD_DESCRIPTOR_FAST_r00: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_or_null;
_PyStackRef callable;
_PyStackRef res;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
@ -17823,7 +17823,7 @@
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
callable,
cfunc,
self,
@ -17832,58 +17832,61 @@
);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache0 = res;
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
_tos_cache0 = PyStackRef_ZERO_BITS;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST_INLINE_r01: {
case _CALL_METHOD_DESCRIPTOR_FAST_INLINE_r00: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_st;
_PyStackRef callable;
_PyStackRef res;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
callable = stack_pointer[-1 - oparg];
self_st = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
PyObject *cfunc = (PyObject *)CURRENT_OPERAND0_64();
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
assert(self != NULL);
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
volatile PyCFunctionFast cfunc_v = _PyCFunctionFast_CAST(cfunc);
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
callable,
cfunc_v,
self,
args,
oparg
args - 1,
oparg + 1
);
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;
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
_tos_cache0 = PyStackRef_ZERO_BITS;
_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__);
SET_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}

View file

@ -3798,7 +3798,7 @@
_PyStackRef callable;
_PyStackRef self_or_null;
_PyStackRef *args;
_PyStackRef res;
_PyStackRef value;
/* Skip 1 cache entry */
/* Skip 2 cache entries */
// _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST
@ -3850,7 +3850,7 @@
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
callable,
cfunc,
self,
@ -3859,17 +3859,32 @@
);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
JUMP_TO_LABEL(error);
}
res = PyStackRef_FromPyObjectSteal(res_o);
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _POP_TOP_OPARG
{
_PyFrame_SetStackPointer(frame, stack_pointer);
_PyStackRef_CloseStack(args, oparg);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _POP_TOP
{
value = self_or_null;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_XCLOSE(value);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _CHECK_PERIODIC_AT_END
{
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
int err = check_periodics(tstate);
stack_pointer = _PyFrame_GetStackPointer(frame);
@ -3894,7 +3909,7 @@
_PyStackRef callable;
_PyStackRef self_or_null;
_PyStackRef *args;
_PyStackRef res;
_PyStackRef value;
/* Skip 1 cache entry */
/* Skip 2 cache entries */
// _GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS
@ -3947,7 +3962,7 @@
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
callable,
cfunc,
self,
@ -3956,17 +3971,32 @@
);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
JUMP_TO_LABEL(error);
}
res = PyStackRef_FromPyObjectSteal(res_o);
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _POP_TOP_OPARG
{
_PyFrame_SetStackPointer(frame, stack_pointer);
_PyStackRef_CloseStack(args, oparg);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _POP_TOP
{
value = self_or_null;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_XCLOSE(value);
stack_pointer = _PyFrame_GetStackPointer(frame);
}
// _CHECK_PERIODIC_AT_END
{
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
int err = check_periodics(tstate);
stack_pointer = _PyFrame_GetStackPointer(frame);

View file

@ -1467,26 +1467,26 @@ dummy_func(void) {
}
}
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[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);
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, oparg, (uintptr_t)cfunc);
}
res = sym_new_not_null(ctx);
callable = sym_new_not_null(ctx);
}
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_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 && 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);
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, oparg, (uintptr_t)cfunc);
}
res = sym_new_not_null(ctx);
callable = sym_new_not_null(ctx);
}
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {

View file

@ -4318,7 +4318,6 @@
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);
@ -4326,23 +4325,14 @@
&& 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);
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, oparg, (uintptr_t)cfunc);
}
res = sym_new_not_null(ctx);
CHECK_STACK_BOUNDS(-1 - oparg);
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
callable = sym_new_not_null(ctx);
stack_pointer[-2 - oparg] = callable;
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;
}
@ -4471,7 +4461,6 @@
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);
@ -4479,23 +4468,14 @@
&& 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);
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, oparg, (uintptr_t)cfunc);
}
res = sym_new_not_null(ctx);
CHECK_STACK_BOUNDS(-1 - oparg);
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
callable = sym_new_not_null(ctx);
stack_pointer[-2 - oparg] = callable;
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;
}