From: Andy Lester <andy@petdance.com>
Date: Sun, 23 Apr 2006 21:50:27 +0000 (-0500)
Subject: Inlining static funcs in perl.c
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6f07c0562911cf76e1e5f209b2eb29c706bd31d;p=p5sagit%2Fp5-mst-13.2.git

Inlining static funcs in perl.c
Message-ID: <20060424025027.GA25998@petdance.com>

p4raw-id: //depot/perl@27941
---

diff --git a/embed.fnc b/embed.fnc
index 82736d7..37c4446 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1198,8 +1198,6 @@ s	|int	|fd_on_nosuid_fs|int fd
 #  endif
 s	|void*	|parse_body	|NULLOK char **env|XSINIT_t xsinit
 rs	|void	|run_body	|I32 oldscope
-s	|void	|call_body	|NN const OP *myop|bool is_eval
-s	|void*	|call_list_body	|NN CV *cv
 s	|SV *	|incpush_if_exists|NN SV *dir
 #endif
 
diff --git a/embed.h b/embed.h
index 430b497..92b68a2 100644
--- a/embed.h
+++ b/embed.h
@@ -1203,8 +1203,6 @@
 #ifdef PERL_CORE
 #define parse_body		S_parse_body
 #define run_body		S_run_body
-#define call_body		S_call_body
-#define call_list_body		S_call_list_body
 #define incpush_if_exists	S_incpush_if_exists
 #endif
 #endif
@@ -3360,8 +3358,6 @@
 #ifdef PERL_CORE
 #define parse_body(a,b)		S_parse_body(aTHX_ a,b)
 #define run_body(a)		S_run_body(aTHX_ a)
-#define call_body(a,b)		S_call_body(aTHX_ a,b)
-#define call_list_body(a)	S_call_list_body(aTHX_ a)
 #define incpush_if_exists(a)	S_incpush_if_exists(aTHX_ a)
 #endif
 #endif
diff --git a/perl.c b/perl.c
index 320793d..184261a 100644
--- a/perl.c
+++ b/perl.c
@@ -137,6 +137,22 @@ static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen);
 #endif
 #endif
 
+#define CALL_BODY_EVAL(myop) \
+    if (PL_op == (myop)) \
+	PL_op = Perl_pp_entereval(aTHX); \
+    if (PL_op) \
+	CALLRUNOPS(aTHX);
+
+#define CALL_BODY_SUB(myop) \
+    if (PL_op == (myop)) \
+	PL_op = Perl_pp_entersub(aTHX); \
+    if (PL_op) \
+	CALLRUNOPS(aTHX);
+
+#define CALL_LIST_BODY(cv) \
+    PUSHMARK(PL_stack_sp); \
+    call_sv((SV*)(cv), G_EVAL|G_DISCARD);
+
 static void
 S_init_tls_and_interp(PerlInterpreter *my_perl)
 {
@@ -2609,7 +2625,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
 
     if (!(flags & G_EVAL)) {
 	CATCH_SET(TRUE);
-	call_body((OP*)&myop, FALSE);
+	CALL_BODY_SUB((OP*)&myop);
 	retval = PL_stack_sp - (PL_stack_base + oldmark);
 	CATCH_SET(oldcatch);
     }
@@ -2624,7 +2640,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
 	switch (ret) {
 	case 0:
  redo_body:
-	    call_body((OP*)&myop, FALSE);
+	    CALL_BODY_SUB((OP*)&myop);
 	    retval = PL_stack_sp - (PL_stack_base + oldmark);
 	    if (!(flags & G_KEEPERR))
 		sv_setpvn(ERRSV,"",0);
@@ -2672,20 +2688,6 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags)
     return retval;
 }
 
-STATIC void
-S_call_body(pTHX_ const OP *myop, bool is_eval)
-{
-    dVAR;
-    if (PL_op == myop) {
-	if (is_eval)
-	    PL_op = Perl_pp_entereval(aTHX);	/* this doesn't do a POPMARK */
-	else
-	    PL_op = Perl_pp_entersub(aTHX);	/* this does */
-    }
-    if (PL_op)
-	CALLRUNOPS(aTHX);
-}
-
 /* Eval a string. The G_EVAL flag is always assumed. */
 
 /*
@@ -2739,7 +2741,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags)
     switch (ret) {
     case 0:
  redo_body:
-	call_body((OP*)&myop,TRUE);
+	CALL_BODY_EVAL((OP*)&myop);
 	retval = PL_stack_sp - (PL_stack_base + oldmark);
 	if (!(flags & G_KEEPERR))
 	    sv_setpvn(ERRSV,"",0);
@@ -5124,7 +5126,7 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
 	    if (PL_madskills)
 		PL_madskills |= 16384;
 #endif
-	    call_list_body(cv);
+	    CALL_LIST_BODY(cv);
 #ifdef PERL_MAD
 	    if (PL_madskills)
 		PL_madskills &= ~16384;
@@ -5189,15 +5191,6 @@ Perl_call_list(pTHX_ I32 oldscope, AV *paramList)
     }
 }
 
-STATIC void *
-S_call_list_body(pTHX_ CV *cv)
-{
-    dVAR;
-    PUSHMARK(PL_stack_sp);
-    call_sv((SV*)cv, G_EVAL|G_DISCARD);
-    return NULL;
-}
-
 void
 Perl_my_exit(pTHX_ U32 status)
 {
diff --git a/proto.h b/proto.h
index 760caa1..fa6de13 100644
--- a/proto.h
+++ b/proto.h
@@ -3261,12 +3261,6 @@ STATIC void*	S_parse_body(pTHX_ char **env, XSINIT_t xsinit);
 STATIC void	S_run_body(pTHX_ I32 oldscope)
 			__attribute__noreturn__;
 
-STATIC void	S_call_body(pTHX_ const OP *myop, bool is_eval)
-			__attribute__nonnull__(pTHX_1);
-
-STATIC void*	S_call_list_body(pTHX_ CV *cv)
-			__attribute__nonnull__(pTHX_1);
-
 STATIC SV *	S_incpush_if_exists(pTHX_ SV *dir)
 			__attribute__nonnull__(pTHX_1);