Revision: 1149
Author: [email protected]
Date: Mon Mar 8 01:50:31 2010
Log: If a callback is passed, move the validity check on the type of
reference from
pp_entersub (in the core) out to load_profile_to_callback. This allows us to
dereference the passed in reference once, and store the CV in
Loader_state_callback, avoiding a check and dereference on every callback
call.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1149
Modified:
/trunk/NYTProf.xs
=======================================
--- /trunk/NYTProf.xs Mon Mar 8 01:50:27 2010
+++ /trunk/NYTProf.xs Mon Mar 8 01:50:31 2010
@@ -3505,7 +3505,7 @@
#ifdef MULTIPLICITY
PerlInterpreter *interp;
#endif
- SV *cb;
+ CV *cb;
SV *cb_args[11]; /* must be large enough for the largest callback
argument list */
SV *tag_names[nytp_tag_max];
SV *input_chunk_seqn_sv;
@@ -4182,7 +4182,7 @@
assert(i <= C_ARRAY_LENGTH(state->cb_args));
PUTBACK;
- call_sv(state->cb, G_DISCARD);
+ call_sv((SV *)state->cb, G_DISCARD);
}
@@ -4583,7 +4583,7 @@
}
static void
-load_profile_to_callback(pTHX_ NYTP_file in, SV *cb)
+load_profile_to_callback(pTHX_ NYTP_file in, CV *cb)
{
Loader_state_callback state;
int i;
@@ -4805,7 +4805,9 @@
croak("Failed to open input '%s': %s", file, strerror(errno));
}
if (cb && SvROK(cb)) {
- load_profile_to_callback(aTHX_ in, cb);
+ if (SvTYPE(SvRV(cb)) != SVt_PVCV)
+ croak("Not a CODE reference");
+ load_profile_to_callback(aTHX_ in, (CV *)SvRV(cb));
RETVAL = newHV(); /* Can we change this to PL_sv_undef? */
} else
RETVAL = load_profile_to_hv(aTHX_ in);
--
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]