Revision: 1064
Author: tim.bunce
Date: Sat Feb 20 03:13:20 2010
Log: Don't profile goto \&sub if subr_entry_ix==0. Fixes RT#54600
(I suspect there could be other cases where the profiler didn't record entry to the sub that invokes the goto but subr_entry_ix!=0. In those cases the caller
of the goto'd sub will appear to the most recently profiled caller.)

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1064

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Fri Feb 19 06:57:57 2010
+++ /trunk/NYTProf.xs   Sat Feb 20 03:13:20 2010
@@ -2368,7 +2368,10 @@
         /* or our DB::_INIT as that makes tests perl version sensitive */
|| (op_type==OP_ENTERSUB && (sub_sv == &PL_sv_yes || sub_sv == DB_INIT_cv || sub_sv == DB_fin_cv))
         /* don't profile other kinds of goto */
- || (op_type==OP_GOTO && !(SvROK(sub_sv) && SvTYPE(SvRV(sub_sv)) == SVt_PVCV))
+    || (op_type==OP_GOTO &&
+        (  !(SvROK(sub_sv) && SvTYPE(SvRV(sub_sv)) == SVt_PVCV)
+ || !subr_entry_ix ) /* goto out of sub whose entry wasn't profiled */
+       )
 #ifdef MULTIPLICITY
     || (my_perl != orig_my_perl)
 #endif
@@ -2380,10 +2383,11 @@
         reinit_if_forked(aTHX);

     if (trace_level >= 99) {
-        logwarn("profiling a call [op %ld]\n", (long)op_type);
+        logwarn("profiling a call [op %ld, %s, seix %d]\n",
+            (long)op_type, PL_op_name[op_type], subr_entry_ix);
         /* crude, but the only way to deal with the miriad logic at the
- * start of pp_entersub (which ought to be available as separate sub)
-            */
+ * start of pp_entersub (which ought to be available as separate sub)
+         */
         sv_dump(sub_sv);
     }

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to