@@ -2318,7 +2318,7 @@ dummy_func(
2318
2318
kwnames = GETITEM (frame -> f_code -> co_consts , oparg );
2319
2319
}
2320
2320
2321
- // Cache layout: counter/1, func_version/2, min_args/1
2321
+ // Cache layout: counter/1, func_version/2
2322
2322
// Neither CALL_INTRINSIC_1/2 nor CALL_FUNCTION_EX are members!
2323
2323
family (call , INLINE_CACHE_ENTRIES_CALL ) = {
2324
2324
CALL ,
@@ -2348,7 +2348,7 @@ dummy_func(
2348
2348
// (Some args may be keywords, see KW_NAMES, which sets 'kwnames'.)
2349
2349
// On exit, the stack is [result].
2350
2350
// When calling Python, inline the call using DISPATCH_INLINED().
2351
- inst (CALL , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2351
+ inst (CALL , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2352
2352
int is_meth = method != NULL ;
2353
2353
int total_args = oparg ;
2354
2354
if (is_meth ) {
@@ -2426,7 +2426,7 @@ dummy_func(
2426
2426
// Start out with [NULL, bound_method, arg1, arg2, ...]
2427
2427
// Transform to [callable, self, arg1, arg2, ...]
2428
2428
// Then fall through to CALL_PY_EXACT_ARGS
2429
- inst (CALL_BOUND_METHOD_EXACT_ARGS , (unused /1 , unused /2 , unused / 1 , method , callable , unused [oparg ] -- unused )) {
2429
+ inst (CALL_BOUND_METHOD_EXACT_ARGS , (unused /1 , unused /2 , method , callable , unused [oparg ] -- unused )) {
2430
2430
DEOPT_IF (method != NULL , CALL );
2431
2431
DEOPT_IF (Py_TYPE (callable ) != & PyMethod_Type , CALL );
2432
2432
STAT_INC (CALL , hit );
@@ -2438,7 +2438,7 @@ dummy_func(
2438
2438
GO_TO_INSTRUCTION (CALL_PY_EXACT_ARGS );
2439
2439
}
2440
2440
2441
- inst (CALL_PY_EXACT_ARGS , (unused /1 , func_version /2 , unused / 1 , method , callable , args [oparg ] -- unused )) {
2441
+ inst (CALL_PY_EXACT_ARGS , (unused /1 , func_version /2 , method , callable , args [oparg ] -- unused )) {
2442
2442
assert (kwnames == NULL );
2443
2443
DEOPT_IF (tstate -> interp -> eval_frame , CALL );
2444
2444
int is_meth = method != NULL ;
@@ -2465,7 +2465,7 @@ dummy_func(
2465
2465
DISPATCH_INLINED (new_frame );
2466
2466
}
2467
2467
2468
- inst (CALL_PY_WITH_DEFAULTS , (unused /1 , func_version /2 , min_args / 1 , method , callable , args [oparg ] -- unused )) {
2468
+ inst (CALL_PY_WITH_DEFAULTS , (unused /1 , func_version /2 , method , callable , args [oparg ] -- unused )) {
2469
2469
assert (kwnames == NULL );
2470
2470
DEOPT_IF (tstate -> interp -> eval_frame , CALL );
2471
2471
int is_meth = method != NULL ;
@@ -2479,6 +2479,11 @@ dummy_func(
2479
2479
PyFunctionObject * func = (PyFunctionObject * )callable ;
2480
2480
DEOPT_IF (func -> func_version != func_version , CALL );
2481
2481
PyCodeObject * code = (PyCodeObject * )func -> func_code ;
2482
+ assert (func -> func_defaults );
2483
+ assert (PyTuple_CheckExact (func -> func_defaults ));
2484
+ int defcount = (int )PyTuple_GET_SIZE (func -> func_defaults );
2485
+ assert (defcount <= code -> co_argcount );
2486
+ int min_args = code -> co_argcount - defcount ;
2482
2487
DEOPT_IF (argcount > code -> co_argcount , CALL );
2483
2488
DEOPT_IF (argcount < min_args , CALL );
2484
2489
DEOPT_IF (!_PyThreadState_HasStackSpace (tstate , code -> co_framesize ), CALL );
@@ -2497,7 +2502,7 @@ dummy_func(
2497
2502
DISPATCH_INLINED (new_frame );
2498
2503
}
2499
2504
2500
- inst (CALL_NO_KW_TYPE_1 , (unused /1 , unused /2 , unused / 1 , null , callable , args [oparg ] -- res )) {
2505
+ inst (CALL_NO_KW_TYPE_1 , (unused /1 , unused /2 , null , callable , args [oparg ] -- res )) {
2501
2506
assert (kwnames == NULL );
2502
2507
assert (cframe .use_tracing == 0 );
2503
2508
assert (oparg == 1 );
@@ -2510,7 +2515,7 @@ dummy_func(
2510
2515
Py_DECREF (& PyType_Type ); // I.e., callable
2511
2516
}
2512
2517
2513
- inst (CALL_NO_KW_STR_1 , (unused /1 , unused /2 , unused / 1 , null , callable , args [oparg ] -- res )) {
2518
+ inst (CALL_NO_KW_STR_1 , (unused /1 , unused /2 , null , callable , args [oparg ] -- res )) {
2514
2519
assert (kwnames == NULL );
2515
2520
assert (cframe .use_tracing == 0 );
2516
2521
assert (oparg == 1 );
@@ -2525,7 +2530,7 @@ dummy_func(
2525
2530
CHECK_EVAL_BREAKER ();
2526
2531
}
2527
2532
2528
- inst (CALL_NO_KW_TUPLE_1 , (unused /1 , unused /2 , unused / 1 , null , callable , args [oparg ] -- res )) {
2533
+ inst (CALL_NO_KW_TUPLE_1 , (unused /1 , unused /2 , null , callable , args [oparg ] -- res )) {
2529
2534
assert (kwnames == NULL );
2530
2535
assert (oparg == 1 );
2531
2536
DEOPT_IF (null != NULL , CALL );
@@ -2539,7 +2544,7 @@ dummy_func(
2539
2544
CHECK_EVAL_BREAKER ();
2540
2545
}
2541
2546
2542
- inst (CALL_BUILTIN_CLASS , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2547
+ inst (CALL_BUILTIN_CLASS , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2543
2548
int is_meth = method != NULL ;
2544
2549
int total_args = oparg ;
2545
2550
if (is_meth ) {
@@ -2564,7 +2569,7 @@ dummy_func(
2564
2569
CHECK_EVAL_BREAKER ();
2565
2570
}
2566
2571
2567
- inst (CALL_NO_KW_BUILTIN_O , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2572
+ inst (CALL_NO_KW_BUILTIN_O , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2568
2573
assert (cframe .use_tracing == 0 );
2569
2574
/* Builtin METH_O functions */
2570
2575
assert (kwnames == NULL );
@@ -2596,7 +2601,7 @@ dummy_func(
2596
2601
CHECK_EVAL_BREAKER ();
2597
2602
}
2598
2603
2599
- inst (CALL_NO_KW_BUILTIN_FAST , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2604
+ inst (CALL_NO_KW_BUILTIN_FAST , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2600
2605
assert (cframe .use_tracing == 0 );
2601
2606
/* Builtin METH_FASTCALL functions, without keywords */
2602
2607
assert (kwnames == NULL );
@@ -2632,7 +2637,7 @@ dummy_func(
2632
2637
CHECK_EVAL_BREAKER ();
2633
2638
}
2634
2639
2635
- inst (CALL_BUILTIN_FAST_WITH_KEYWORDS , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2640
+ inst (CALL_BUILTIN_FAST_WITH_KEYWORDS , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2636
2641
assert (cframe .use_tracing == 0 );
2637
2642
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
2638
2643
int is_meth = method != NULL ;
@@ -2668,7 +2673,7 @@ dummy_func(
2668
2673
CHECK_EVAL_BREAKER ();
2669
2674
}
2670
2675
2671
- inst (CALL_NO_KW_LEN , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2676
+ inst (CALL_NO_KW_LEN , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2672
2677
assert (cframe .use_tracing == 0 );
2673
2678
assert (kwnames == NULL );
2674
2679
/* len(o) */
@@ -2696,7 +2701,7 @@ dummy_func(
2696
2701
ERROR_IF (res == NULL , error );
2697
2702
}
2698
2703
2699
- inst (CALL_NO_KW_ISINSTANCE , (unused /1 , unused /2 , unused / 1 , method , callable , args [oparg ] -- res )) {
2704
+ inst (CALL_NO_KW_ISINSTANCE , (unused /1 , unused /2 , method , callable , args [oparg ] -- res )) {
2700
2705
assert (cframe .use_tracing == 0 );
2701
2706
assert (kwnames == NULL );
2702
2707
/* isinstance(o, o2) */
@@ -2727,7 +2732,7 @@ dummy_func(
2727
2732
}
2728
2733
2729
2734
// This is secretly a super-instruction
2730
- inst (CALL_NO_KW_LIST_APPEND , (unused /1 , unused /2 , unused / 1 , method , self , args [oparg ] -- unused )) {
2735
+ inst (CALL_NO_KW_LIST_APPEND , (unused /1 , unused /2 , method , self , args [oparg ] -- unused )) {
2731
2736
assert (cframe .use_tracing == 0 );
2732
2737
assert (kwnames == NULL );
2733
2738
assert (oparg == 1 );
@@ -2748,7 +2753,7 @@ dummy_func(
2748
2753
DISPATCH ();
2749
2754
}
2750
2755
2751
- inst (CALL_NO_KW_METHOD_DESCRIPTOR_O , (unused /1 , unused /2 , unused / 1 , method , unused , args [oparg ] -- res )) {
2756
+ inst (CALL_NO_KW_METHOD_DESCRIPTOR_O , (unused /1 , unused /2 , method , unused , args [oparg ] -- res )) {
2752
2757
assert (kwnames == NULL );
2753
2758
int is_meth = method != NULL ;
2754
2759
int total_args = oparg ;
@@ -2782,7 +2787,7 @@ dummy_func(
2782
2787
CHECK_EVAL_BREAKER ();
2783
2788
}
2784
2789
2785
- inst (CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS , (unused /1 , unused /2 , unused / 1 , method , unused , args [oparg ] -- res )) {
2790
+ inst (CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS , (unused /1 , unused /2 , method , unused , args [oparg ] -- res )) {
2786
2791
int is_meth = method != NULL ;
2787
2792
int total_args = oparg ;
2788
2793
if (is_meth ) {
@@ -2814,7 +2819,7 @@ dummy_func(
2814
2819
CHECK_EVAL_BREAKER ();
2815
2820
}
2816
2821
2817
- inst (CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS , (unused /1 , unused /2 , unused / 1 , method , unused , args [oparg ] -- res )) {
2822
+ inst (CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS , (unused /1 , unused /2 , method , unused , args [oparg ] -- res )) {
2818
2823
assert (kwnames == NULL );
2819
2824
assert (oparg == 0 || oparg == 1 );
2820
2825
int is_meth = method != NULL ;
@@ -2846,7 +2851,7 @@ dummy_func(
2846
2851
CHECK_EVAL_BREAKER ();
2847
2852
}
2848
2853
2849
- inst (CALL_NO_KW_METHOD_DESCRIPTOR_FAST , (unused /1 , unused /2 , unused / 1 , method , unused , args [oparg ] -- res )) {
2854
+ inst (CALL_NO_KW_METHOD_DESCRIPTOR_FAST , (unused /1 , unused /2 , method , unused , args [oparg ] -- res )) {
2850
2855
assert (kwnames == NULL );
2851
2856
int is_meth = method != NULL ;
2852
2857
int total_args = oparg ;
0 commit comments