summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-04-03 21:01:09 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-04-03 21:01:09 +0000
commit67caa1fef1ac64bae9d7c9deecbf100088307e6f (patch)
tree30866fdce7cc404aa0065c3f51eac0a92dae5562
parent6fc9266916f08dacf1850556174b6312eefb14e6 (diff)
downloadperl-67caa1fef1ac64bae9d7c9deecbf100088307e6f.tar.gz
scrounge and save three extra branches in pp_entersub()
p4raw-id: //depot/perl@3214
-rw-r--r--cv.h2
-rw-r--r--pp_ctl.c5
-rw-r--r--pp_hot.c40
3 files changed, 29 insertions, 18 deletions
diff --git a/cv.h b/cv.h
index 9605135ffc..cf5a7509d0 100644
--- a/cv.h
+++ b/cv.h
@@ -75,9 +75,11 @@ struct xpvcv {
#define CvANON_on(cv) (CvFLAGS(cv) |= CVf_ANON)
#define CvANON_off(cv) (CvFLAGS(cv) &= ~CVf_ANON)
+#ifdef PERL_XSUB_OLDSTYLE
#define CvOLDSTYLE(cv) (CvFLAGS(cv) & CVf_OLDSTYLE)
#define CvOLDSTYLE_on(cv) (CvFLAGS(cv) |= CVf_OLDSTYLE)
#define CvOLDSTYLE_off(cv) (CvFLAGS(cv) &= ~CVf_OLDSTYLE)
+#endif
#define CvUNIQUE(cv) (CvFLAGS(cv) & CVf_UNIQUE)
#define CvUNIQUE_on(cv) (CvFLAGS(cv) |= CVf_UNIQUE)
diff --git a/pp_ctl.c b/pp_ctl.c
index 9d22e64e58..da56ecab56 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2120,6 +2120,7 @@ PP(pp_goto)
/* Now do some callish stuff. */
SAVETMPS;
if (CvXSUB(cv)) {
+#ifdef PERL_XSUB_OLDSTYLE
if (CvOLDSTYLE(cv)) {
I32 (*fp3)_((int,int,int));
while (SP > mark) {
@@ -2132,7 +2133,9 @@ PP(pp_goto)
items);
SP = PL_stack_base + items;
}
- else {
+ else
+#endif /* PERL_XSUB_OLDSTYLE */
+ {
SV **newsp;
I32 gimme;
diff --git a/pp_hot.c b/pp_hot.c
index cdfe8c430b..f48e98f8dc 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2093,16 +2093,15 @@ PP(pp_entersub)
case SVt_PVGV:
if (!(cv = GvCVu((GV*)sv)))
cv = sv_2cv(sv, &stash, &gv, TRUE);
- break;
+ if (cv)
+ break;
+ DIE("Not a CODE reference");
}
ENTER;
SAVETMPS;
retry:
- if (!cv)
- DIE("Not a CODE reference");
-
if (!CvROOT(cv) && !CvXSUB(cv)) {
GV* autogv;
SV* sub_name;
@@ -2110,29 +2109,34 @@ PP(pp_entersub)
/* anonymous or undef'd function leaves us no recourse */
if (CvANON(cv) || !(gv = CvGV(cv)))
DIE("Undefined subroutine called");
+
/* autoloaded stub? */
if (cv != GvCV(gv)) {
cv = GvCV(gv);
- goto retry;
}
/* should call AUTOLOAD now? */
- if ((autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv),
+ else if ((autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv),
FALSE)))
{
cv = GvCV(autogv);
- goto retry;
}
/* sorry */
- sub_name = sv_newmortal();
- gv_efullname3(sub_name, gv, Nullch);
- DIE("Undefined subroutine &%s called", SvPVX(sub_name));
+ else {
+ sub_name = sv_newmortal();
+ gv_efullname3(sub_name, gv, Nullch);
+ DIE("Undefined subroutine &%s called", SvPVX(sub_name));
+ }
+ if (!cv)
+ DIE("Not a CODE reference");
+ goto retry;
}
gimme = GIMME_V;
- if ((PL_op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub) && !CvNODEBUG(cv))
+ if ((PL_op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub) && !CvNODEBUG(cv)) {
cv = get_db_sub(&sv, cv);
- if (!cv)
- DIE("No DBsub routine");
+ if (!cv)
+ DIE("No DBsub routine");
+ }
#ifdef USE_THREADS
/*
@@ -2268,6 +2272,7 @@ PP(pp_entersub)
#endif /* USE_THREADS */
if (CvXSUB(cv)) {
+#ifdef PERL_XSUB_OLDSTYLE
if (CvOLDSTYLE(cv)) {
I32 (*fp3)_((int,int,int));
dMARK;
@@ -2284,7 +2289,9 @@ PP(pp_entersub)
items);
PL_stack_sp = PL_stack_base + items;
}
- else {
+ else
+#endif /* PERL_XSUB_OLDSTYLE */
+ {
I32 markix = TOPMARK;
PUTBACK;
@@ -2310,9 +2317,8 @@ PP(pp_entersub)
PUTBACK ;
}
}
- if (PL_curcopdb) { /* We assume that the first
- XSUB in &DB::sub is the
- called one. */
+ /* We assume first XSUB in &DB::sub is the called one. */
+ if (PL_curcopdb) {
SAVESPTR(PL_curcop);
PL_curcop = PL_curcopdb;
PL_curcopdb = NULL;