@@ -2358,7 +2358,7 @@ dummy_func(
2358
2358
CALL ,
2359
2359
CALL_BOUND_METHOD_EXACT_ARGS ,
2360
2360
CALL_PY_EXACT_ARGS ,
2361
- // CALL_PY_WITH_DEFAULTS,
2361
+ CALL_PY_WITH_DEFAULTS ,
2362
2362
// CALL_NO_KW_TYPE_1,
2363
2363
// CALL_NO_KW_STR_1,
2364
2364
// CALL_NO_KW_TUPLE_1,
@@ -2505,34 +2505,31 @@ dummy_func(
2505
2505
DISPATCH_INLINED (new_frame );
2506
2506
}
2507
2507
2508
- // stack effect: (__0, __array[oparg] -- )
2509
- inst (CALL_PY_WITH_DEFAULTS ) {
2508
+ inst (CALL_PY_WITH_DEFAULTS , (unused /1 , func_version /2 , min_args /1 , thing1 , thing2 , unused [oparg ] -- unused )) {
2510
2509
assert (kwnames == NULL );
2511
2510
DEOPT_IF (tstate -> interp -> eval_frame , CALL );
2512
- _PyCallCache * cache = (_PyCallCache * )next_instr ;
2513
- int is_meth = is_method (stack_pointer , oparg );
2511
+ int is_meth = thing1 != NULL ;
2514
2512
int argcount = oparg + is_meth ;
2515
- PyObject * callable = PEEK ( argcount + 1 ) ;
2513
+ PyObject * callable = is_meth ? thing1 : thing2 ;
2516
2514
DEOPT_IF (!PyFunction_Check (callable ), CALL );
2517
2515
PyFunctionObject * func = (PyFunctionObject * )callable ;
2518
- DEOPT_IF (func -> func_version != read_u32 ( cache -> func_version ) , CALL );
2516
+ DEOPT_IF (func -> func_version != func_version , CALL );
2519
2517
PyCodeObject * code = (PyCodeObject * )func -> func_code ;
2520
2518
DEOPT_IF (argcount > code -> co_argcount , CALL );
2521
- int minargs = cache -> min_args ;
2522
- DEOPT_IF (argcount < minargs , CALL );
2519
+ DEOPT_IF (argcount < min_args , CALL );
2523
2520
DEOPT_IF (!_PyThreadState_HasStackSpace (tstate , code -> co_framesize ), CALL );
2524
2521
STAT_INC (CALL , hit );
2525
2522
_PyInterpreterFrame * new_frame = _PyFrame_PushUnchecked (tstate , func , code -> co_argcount );
2523
+ // Manipulate stack directly since we leave using DISPATCH_INLINED().
2526
2524
STACK_SHRINK (argcount );
2527
2525
for (int i = 0 ; i < argcount ; i ++ ) {
2528
2526
new_frame -> localsplus [i ] = stack_pointer [i ];
2529
2527
}
2530
2528
for (int i = argcount ; i < code -> co_argcount ; i ++ ) {
2531
- PyObject * def = PyTuple_GET_ITEM (func -> func_defaults ,
2532
- i - minargs );
2529
+ PyObject * def = PyTuple_GET_ITEM (func -> func_defaults , i - min_args );
2533
2530
new_frame -> localsplus [i ] = Py_NewRef (def );
2534
2531
}
2535
- STACK_SHRINK (2 - is_meth );
2532
+ STACK_SHRINK (2 - is_meth );
2536
2533
JUMPBY (INLINE_CACHE_ENTRIES_CALL );
2537
2534
DISPATCH_INLINED (new_frame );
2538
2535
}
0 commit comments