mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support of calls. (GH-118322)
* Add CALL_PY_GENERAL, CALL_BOUND_METHOD_GENERAL and call CALL_NON_PY_GENERAL specializations. * Remove CALL_PY_WITH_DEFAULTS specialization * Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize
This commit is contained in:
parent
00da0afa0d
commit
1ab6356ebe
19 changed files with 862 additions and 447 deletions
56
Python/optimizer_cases.c.h
generated
56
Python/optimizer_cases.c.h
generated
|
@ -1559,6 +1559,58 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _PY_FRAME_GENERAL: {
|
||||
_Py_UopsSymbol **args;
|
||||
_Py_UopsSymbol *self_or_null;
|
||||
_Py_UopsSymbol *callable;
|
||||
_Py_UOpsAbstractFrame *new_frame;
|
||||
args = &stack_pointer[-oparg];
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
/* The _Py_UOpsAbstractFrame design assumes that we can copy arguments across directly */
|
||||
(void)callable;
|
||||
(void)self_or_null;
|
||||
(void)args;
|
||||
first_valid_check_stack = NULL;
|
||||
goto done;
|
||||
stack_pointer[-2 - oparg] = (_Py_UopsSymbol *)new_frame;
|
||||
stack_pointer += -1 - oparg;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_FUNCTION_VERSION: {
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_METHOD_VERSION: {
|
||||
break;
|
||||
}
|
||||
|
||||
case _EXPAND_METHOD: {
|
||||
_Py_UopsSymbol *method;
|
||||
_Py_UopsSymbol *self;
|
||||
method = sym_new_not_null(ctx);
|
||||
if (method == NULL) goto out_of_space;
|
||||
self = sym_new_not_null(ctx);
|
||||
if (self == NULL) goto out_of_space;
|
||||
stack_pointer[-2 - oparg] = method;
|
||||
stack_pointer[-1 - oparg] = self;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_IS_NOT_PY_CALLABLE: {
|
||||
break;
|
||||
}
|
||||
|
||||
case _CALL_NON_PY_GENERAL: {
|
||||
_Py_UopsSymbol *res;
|
||||
res = sym_new_not_null(ctx);
|
||||
if (res == NULL) goto out_of_space;
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
stack_pointer += -1 - oparg;
|
||||
break;
|
||||
}
|
||||
|
||||
case _CHECK_CALL_BOUND_METHOD_EXACT_ARGS: {
|
||||
_Py_UopsSymbol *null;
|
||||
_Py_UopsSymbol *callable;
|
||||
|
@ -1692,7 +1744,7 @@
|
|||
if (first_valid_check_stack == NULL) {
|
||||
first_valid_check_stack = corresponding_check_stack;
|
||||
}
|
||||
else {
|
||||
else if (corresponding_check_stack) {
|
||||
// delete all but the first valid _CHECK_STACK_SPACE
|
||||
corresponding_check_stack->opcode = _NOP;
|
||||
}
|
||||
|
@ -1700,8 +1752,6 @@
|
|||
break;
|
||||
}
|
||||
|
||||
/* _CALL_PY_WITH_DEFAULTS is not a viable micro-op for tier 2 */
|
||||
|
||||
case _CALL_TYPE_1: {
|
||||
_Py_UopsSymbol *res;
|
||||
res = sym_new_not_null(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue