]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Gather stats for PRECALL_METHOD. (GH-31259)
authorMark Shannon <mark@hotpy.org>
Thu, 10 Feb 2022 15:55:52 +0000 (15:55 +0000)
committerGitHub <noreply@github.com>
Thu, 10 Feb 2022 15:55:52 +0000 (15:55 +0000)
Python/ceval.c
Python/specialize.c

index c3703a75ce0cac96039032bd71e9788f6364b7d3..ffce6b735c1c285267a15f73fad830a4003a0f35 100644 (file)
@@ -4451,8 +4451,11 @@ handle_eval_breaker:
             assert(call_shape.kwnames == NULL);
 #ifdef Py_STATS
             extern int _PySpecialization_ClassifyCallable(PyObject *);
-            _py_stats.opcode_stats[PRECALL_FUNCTION].specialization.failure++;
-            _py_stats.opcode_stats[PRECALL_FUNCTION].specialization.failure_kinds[_PySpecialization_ClassifyCallable(call_shape.callable)]++;
+            SpecializationStats *stats =
+                &_py_stats.opcode_stats[PRECALL_FUNCTION].specialization;
+            stats->failure++;
+            int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
+            stats->failure_kinds[kind]++;
 #endif
             DISPATCH();
         }
@@ -4493,6 +4496,14 @@ handle_eval_breaker:
 
             call_shape.total_args = nargs;
             assert(call_shape.kwnames == NULL);
+#ifdef Py_STATS
+            extern int _PySpecialization_ClassifyCallable(PyObject *);
+            SpecializationStats *stats =
+                &_py_stats.opcode_stats[PRECALL_METHOD].specialization;
+            stats->failure++;
+            int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
+            stats->failure_kinds[kind]++;
+#endif
             DISPATCH();
         }
 
index 940ab172d55fe25f3cd5401850c53117e0cecc84..b051f45157ad34024ed17466d7025412a7397558 100644 (file)
@@ -176,6 +176,7 @@ print_spec_stats(FILE *out, OpcodeStats *stats)
      * even though we don't specialize them yet. */
     fprintf(out, "    opcode[%d].specializable : 1\n", FOR_ITER);
     fprintf(out, "    opcode[%d].specializable : 1\n", PRECALL_FUNCTION);
+    fprintf(out, "    opcode[%d].specializable : 1\n", PRECALL_METHOD);
     fprintf(out, "    opcode[%d].specializable : 1\n", UNPACK_SEQUENCE);
     for (int i = 0; i < 256; i++) {
         if (adaptive_opcodes[i]) {