@@ -2370,7 +2370,7 @@ dummy_func(
2370
2370
CALL ,
2371
2371
CALL_BOUND_METHOD_EXACT_ARGS ,
2372
2372
CALL_PY_EXACT_ARGS ,
2373
- // CALL_PY_WITH_DEFAULTS,
2373
+ CALL_PY_WITH_DEFAULTS ,
2374
2374
// CALL_NO_KW_TYPE_1,
2375
2375
// CALL_NO_KW_STR_1,
2376
2376
// CALL_NO_KW_TUPLE_1,
@@ -2517,34 +2517,31 @@ dummy_func(
2517
2517
DISPATCH_INLINED (new_frame );
2518
2518
}
2519
2519
2520
- // stack effect: (__0, __array[oparg] -- )
2521
- inst (CALL_PY_WITH_DEFAULTS ) {
2520
+ inst (CALL_PY_WITH_DEFAULTS , (unused /1 , func_version /2 , min_args /1 , thing1 , thing2 , unused [oparg ] -- unused )) {
2522
2521
assert (kwnames == NULL );
2523
2522
DEOPT_IF (tstate -> interp -> eval_frame , CALL );
2524
- _PyCallCache * cache = (_PyCallCache * )next_instr ;
2525
- int is_meth = is_method (stack_pointer , oparg );
2523
+ int is_meth = thing1 != NULL ;
2526
2524
int argcount = oparg + is_meth ;
2527
- PyObject * callable = PEEK ( argcount + 1 ) ;
2525
+ PyObject * callable = is_meth ? thing1 : thing2 ;
2528
2526
DEOPT_IF (!PyFunction_Check (callable ), CALL );
2529
2527
PyFunctionObject * func = (PyFunctionObject * )callable ;
2530
- DEOPT_IF (func -> func_version != read_u32 ( cache -> func_version ) , CALL );
2528
+ DEOPT_IF (func -> func_version != func_version , CALL );
2531
2529
PyCodeObject * code = (PyCodeObject * )func -> func_code ;
2532
2530
DEOPT_IF (argcount > code -> co_argcount , CALL );
2533
- int minargs = cache -> min_args ;
2534
- DEOPT_IF (argcount < minargs , CALL );
2531
+ DEOPT_IF (argcount < min_args , CALL );
2535
2532
DEOPT_IF (!_PyThreadState_HasStackSpace (tstate , code -> co_framesize ), CALL );
2536
2533
STAT_INC (CALL , hit );
2537
2534
_PyInterpreterFrame * new_frame = _PyFrame_PushUnchecked (tstate , func , code -> co_argcount );
2535
+ // Manipulate stack directly since we leave using DISPATCH_INLINED().
2538
2536
STACK_SHRINK (argcount );
2539
2537
for (int i = 0 ; i < argcount ; i ++ ) {
2540
2538
new_frame -> localsplus [i ] = stack_pointer [i ];
2541
2539
}
2542
2540
for (int i = argcount ; i < code -> co_argcount ; i ++ ) {
2543
- PyObject * def = PyTuple_GET_ITEM (func -> func_defaults ,
2544
- i - minargs );
2541
+ PyObject * def = PyTuple_GET_ITEM (func -> func_defaults , i - min_args );
2545
2542
new_frame -> localsplus [i ] = Py_NewRef (def );
2546
2543
}
2547
- STACK_SHRINK (2 - is_meth );
2544
+ STACK_SHRINK (2 - is_meth );
2548
2545
JUMPBY (INLINE_CACHE_ENTRIES_CALL );
2549
2546
DISPATCH_INLINED (new_frame );
2550
2547
}
0 commit comments