Revision: 907
Author: tim.bunce
Date: Sun Nov 15 13:11:36 2009
Log: Reordered logic to not push the extra destructor until the end of the  
function
and so no longer push the destructor for a substcont that's already left  
the scope.

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

Modified:
  /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Sun Nov 15 03:25:28 2009
+++ /trunk/NYTProf.xs   Sun Nov 15 13:11:36 2009
@@ -2783,11 +2783,6 @@
          this_subr_entry_ix = subr_entry_setup(aTHX_ prev_cop,  
&goto_subr_entry, op_type, sub_sv);
          SvREFCNT_dec(sub_sv);
      }
-
-    /* push a destructor hook onto the context stack to ensure we account
-     * for time in the sub when we leave it, even if via an exception.
-     */
-    save_destructor_x(incr_sub_inclusive_time_ix, INT2PTR(void *,  
(IV)this_subr_entry_ix));

      subr_entry = subr_entry_ix_ptr(this_subr_entry_ix);

@@ -2915,10 +2910,16 @@

      if (subr_entry->called_is_xs) {
          /* for xsubs/builtins we've already left the sub, so end the  
timing now
-            * rather than wait for the calling scope to get cleaned up.
-            */
+         * rather than wait for the calling scope to get cleaned up.
+         */
          incr_sub_inclusive_time(aTHX_ subr_entry);
      }
+    else {
+        /* push a destructor hook onto the context stack to ensure we  
account
+         * for time in the sub when we leave it, even if via an exception.
+         */
+        save_destructor_x(incr_sub_inclusive_time_ix, INT2PTR(void *,  
(IV)this_subr_entry_ix));
+    }

      skip_sub_profile:
      SETERRNO(saved_errno, 0);

-- 
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