diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-11-30 22:46:37 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-11-30 22:46:37 +0000 |
commit | 2fd8beea017eccf05d12bfa6e4db7c5340ce637b (patch) | |
tree | 49346b27333d4b5a7519f212fe63cced96e2933a | |
parent | c6ae76470e6575530141df6c32cf71111bc2e391 (diff) | |
download | perl-2fd8beea017eccf05d12bfa6e4db7c5340ce637b.tar.gz |
Convert all the scope save functions of the form
SSCHECK(2);
SSPUSHPTR(o);
SSPUSHINT(SAVEt_FREEOP);
into a single function Perl_save_pushptr(ptr, type), which the others
call. Implement the others as macros. This reduces the object code size.
p4raw-id: //depot/perl@34956
-rw-r--r-- | embed.fnc | 11 | ||||
-rw-r--r-- | embed.h | 16 | ||||
-rw-r--r-- | global.sym | 3 | ||||
-rw-r--r-- | mathoms.c | 38 | ||||
-rw-r--r-- | proto.h | 13 | ||||
-rw-r--r-- | scope.c | 45 | ||||
-rw-r--r-- | scope.h | 6 |
7 files changed, 65 insertions, 67 deletions
@@ -891,10 +891,10 @@ Ap |void |save_clearsv |NN SV** svp Ap |void |save_delete |NN HV *hv|NN char *key|I32 klen Ap |void |save_destructor|DESTRUCTORFUNC_NOCONTEXT_t f|NN void* p Ap |void |save_destructor_x|DESTRUCTORFUNC_t f|NULLOK void* p -Ap |void |save_freesv |NULLOK SV* sv +Apmb |void |save_freesv |NULLOK SV* sv : Used in SAVEFREOP(), used in op.c, pp_ctl.c -p |void |save_freeop |NULLOK OP* o -Ap |void |save_freepv |NULLOK char* pv +pmb |void |save_freeop |NULLOK OP* o +Apmb |void |save_freepv |NULLOK char* pv Ap |void |save_generic_svref|NN SV** sptr Ap |void |save_generic_pvref|NN char** str Ap |void |save_shared_pvref|NN char** str @@ -911,10 +911,10 @@ Ap |void |save_item |NN SV* item Ap |void |save_iv |NN IV *ivp Ap |void |save_list |NN SV** sarg|I32 maxsarg Ap |void |save_long |NN long* longp -Ap |void |save_mortalizesv|NN SV* sv +Apmb |void |save_mortalizesv|NN SV* sv Ap |void |save_nogv |NN GV* gv : Used in SAVEFREOP(), used in gv.c, op.c, perl.c, pp_ctl.c, pp_sort.c -p |void |save_op +pmb |void |save_op Ap |SV* |save_scalar |NN GV* gv Ap |void |save_pptr |NN char** pptr Ap |void |save_vptr |NN void *ptr @@ -922,6 +922,7 @@ Ap |void |save_re_context Ap |void |save_padsv_and_mortalize|PADOFFSET off Ap |void |save_sptr |NN SV** sptr Ap |SV* |save_svref |NN SV** sptr +Ap |void |save_pushptr |NULLOK void *const ptr|const int type : Used in perly.y p |OP* |sawparens |NULLOK OP* o : Used in perly.y @@ -782,11 +782,6 @@ #define save_delete Perl_save_delete #define save_destructor Perl_save_destructor #define save_destructor_x Perl_save_destructor_x -#define save_freesv Perl_save_freesv -#ifdef PERL_CORE -#define save_freeop Perl_save_freeop -#endif -#define save_freepv Perl_save_freepv #define save_generic_svref Perl_save_generic_svref #define save_generic_pvref Perl_save_generic_pvref #define save_shared_pvref Perl_save_shared_pvref @@ -802,11 +797,7 @@ #define save_iv Perl_save_iv #define save_list Perl_save_list #define save_long Perl_save_long -#define save_mortalizesv Perl_save_mortalizesv #define save_nogv Perl_save_nogv -#ifdef PERL_CORE -#define save_op Perl_save_op -#endif #define save_scalar Perl_save_scalar #define save_pptr Perl_save_pptr #define save_vptr Perl_save_vptr @@ -814,6 +805,7 @@ #define save_padsv_and_mortalize Perl_save_padsv_and_mortalize #define save_sptr Perl_save_sptr #define save_svref Perl_save_svref +#define save_pushptr Perl_save_pushptr #ifdef PERL_CORE #define sawparens Perl_sawparens #define scalar Perl_scalar @@ -3130,11 +3122,8 @@ #define save_delete(a,b,c) Perl_save_delete(aTHX_ a,b,c) #define save_destructor(a,b) Perl_save_destructor(aTHX_ a,b) #define save_destructor_x(a,b) Perl_save_destructor_x(aTHX_ a,b) -#define save_freesv(a) Perl_save_freesv(aTHX_ a) #ifdef PERL_CORE -#define save_freeop(a) Perl_save_freeop(aTHX_ a) #endif -#define save_freepv(a) Perl_save_freepv(aTHX_ a) #define save_generic_svref(a) Perl_save_generic_svref(aTHX_ a) #define save_generic_pvref(a) Perl_save_generic_pvref(aTHX_ a) #define save_shared_pvref(a) Perl_save_shared_pvref(aTHX_ a) @@ -3150,10 +3139,8 @@ #define save_iv(a) Perl_save_iv(aTHX_ a) #define save_list(a,b) Perl_save_list(aTHX_ a,b) #define save_long(a) Perl_save_long(aTHX_ a) -#define save_mortalizesv(a) Perl_save_mortalizesv(aTHX_ a) #define save_nogv(a) Perl_save_nogv(aTHX_ a) #ifdef PERL_CORE -#define save_op() Perl_save_op(aTHX) #endif #define save_scalar(a) Perl_save_scalar(aTHX_ a) #define save_pptr(a) Perl_save_pptr(aTHX_ a) @@ -3162,6 +3149,7 @@ #define save_padsv_and_mortalize(a) Perl_save_padsv_and_mortalize(aTHX_ a) #define save_sptr(a) Perl_save_sptr(aTHX_ a) #define save_svref(a) Perl_save_svref(aTHX_ a) +#define save_pushptr(a,b) Perl_save_pushptr(aTHX_ a,b) #ifdef PERL_CORE #define sawparens(a) Perl_sawparens(aTHX_ a) #define scalar(a) Perl_scalar(aTHX_ a) diff --git a/global.sym b/global.sym index acd525f8ab..fe26578fb3 100644 --- a/global.sym +++ b/global.sym @@ -443,6 +443,7 @@ Perl_save_delete Perl_save_destructor Perl_save_destructor_x Perl_save_freesv +Perl_save_freeop Perl_save_freepv Perl_save_generic_svref Perl_save_generic_pvref @@ -461,6 +462,7 @@ Perl_save_list Perl_save_long Perl_save_mortalizesv Perl_save_nogv +Perl_save_op Perl_save_scalar Perl_save_pptr Perl_save_vptr @@ -468,6 +470,7 @@ Perl_save_re_context Perl_save_padsv_and_mortalize Perl_save_sptr Perl_save_svref +Perl_save_pushptr Perl_scan_bin Perl_scan_hex Perl_scan_num @@ -1429,6 +1429,44 @@ Perl_sv_insert(pTHX_ SV *const bigstr, const STRLEN offset, const STRLEN len, sv_insert_flags(bigstr, offset, len, little, littlelen, SV_GMAGIC); } +void +Perl_save_freesv(pTHX_ SV *sv) +{ + dVAR; + save_freesv(sv); +} + +void +Perl_save_mortalizesv(pTHX_ SV *sv) +{ + dVAR; + + PERL_ARGS_ASSERT_SAVE_MORTALIZESV; + + save_mortalizesv(sv); +} + +void +Perl_save_freeop(pTHX_ OP *o) +{ + dVAR; + save_freeop(o); +} + +void +Perl_save_freepv(pTHX_ char *pv) +{ + dVAR; + save_freepv(pv); +} + +void +Perl_save_op(pTHX) +{ + dVAR; + save_op(); +} + #endif /* NO_MATHOMS */ /* @@ -2787,9 +2787,9 @@ PERL_CALLCONV void Perl_save_destructor(pTHX_ DESTRUCTORFUNC_NOCONTEXT_t f, void assert(p) PERL_CALLCONV void Perl_save_destructor_x(pTHX_ DESTRUCTORFUNC_t f, void* p); -PERL_CALLCONV void Perl_save_freesv(pTHX_ SV* sv); -PERL_CALLCONV void Perl_save_freeop(pTHX_ OP* o); -PERL_CALLCONV void Perl_save_freepv(pTHX_ char* pv); +/* PERL_CALLCONV void Perl_save_freesv(pTHX_ SV* sv); */ +/* PERL_CALLCONV void Perl_save_freeop(pTHX_ OP* o); */ +/* PERL_CALLCONV void Perl_save_freepv(pTHX_ char* pv); */ PERL_CALLCONV void Perl_save_generic_svref(pTHX_ SV** sptr) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SAVE_GENERIC_SVREF \ @@ -2874,8 +2874,8 @@ PERL_CALLCONV void Perl_save_long(pTHX_ long* longp) #define PERL_ARGS_ASSERT_SAVE_LONG \ assert(longp) -PERL_CALLCONV void Perl_save_mortalizesv(pTHX_ SV* sv) - __attribute__nonnull__(pTHX_1); +/* PERL_CALLCONV void Perl_save_mortalizesv(pTHX_ SV* sv) + __attribute__nonnull__(pTHX_1); */ #define PERL_ARGS_ASSERT_SAVE_MORTALIZESV \ assert(sv) @@ -2884,7 +2884,7 @@ PERL_CALLCONV void Perl_save_nogv(pTHX_ GV* gv) #define PERL_ARGS_ASSERT_SAVE_NOGV \ assert(gv) -PERL_CALLCONV void Perl_save_op(pTHX); +/* PERL_CALLCONV void Perl_save_op(pTHX); */ PERL_CALLCONV SV* Perl_save_scalar(pTHX_ GV* gv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SAVE_SCALAR \ @@ -2912,6 +2912,7 @@ PERL_CALLCONV SV* Perl_save_svref(pTHX_ SV** sptr) #define PERL_ARGS_ASSERT_SAVE_SVREF \ assert(sptr) +PERL_CALLCONV void Perl_save_pushptr(pTHX_ void *const ptr, const int type); PERL_CALLCONV OP* Perl_sawparens(pTHX_ OP* o); PERL_CALLCONV OP* Perl_scalar(pTHX_ OP* o); #if defined(PERL_IN_OP_C) @@ -505,42 +505,12 @@ Perl_save_aptr(pTHX_ AV **aptr) } void -Perl_save_freesv(pTHX_ SV *sv) +Perl_save_pushptr(pTHX_ void *const ptr, const int type) { dVAR; SSCHECK(2); - SSPUSHPTR(sv); - SSPUSHINT(SAVEt_FREESV); -} - -void -Perl_save_mortalizesv(pTHX_ SV *sv) -{ - dVAR; - - PERL_ARGS_ASSERT_SAVE_MORTALIZESV; - - SSCHECK(2); - SSPUSHPTR(sv); - SSPUSHINT(SAVEt_MORTALIZESV); -} - -void -Perl_save_freeop(pTHX_ OP *o) -{ - dVAR; - SSCHECK(2); - SSPUSHPTR(o); - SSPUSHINT(SAVEt_FREEOP); -} - -void -Perl_save_freepv(pTHX_ char *pv) -{ - dVAR; - SSCHECK(2); - SSPUSHPTR(pv); - SSPUSHINT(SAVEt_FREEPV); + SSPUSHPTR(ptr); + SSPUSHINT(type); } void @@ -660,15 +630,6 @@ Perl_save_svref(pTHX_ SV **sptr) return save_scalar_at(sptr, SAVEf_SETMAGIC); /* XXX - FIXME - see #60360 */ } -void -Perl_save_op(pTHX) -{ - dVAR; - SSCHECK(2); - SSPUSHPTR(PL_op); - SSPUSHINT(SAVEt_OP); -} - I32 Perl_save_alloc(pTHX_ I32 size, I32 pad) { @@ -260,6 +260,12 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>. #define SSPTR(off,type) ((type) ((char*)PL_savestack + off)) #define SSPTRt(off,type) ((type*) ((char*)PL_savestack + off)) +#define save_freesv(op) save_pushptr((void *)(op), SAVEt_FREESV) +#define save_mortalizesv(op) save_pushptr((void *)(op), SAVEt_MORTALIZESV) +#define save_freeop(op) save_pushptr((void *)(op), SAVEt_FREEOP) +#define save_freepv(pv) save_pushptr((void *)(pv), SAVEt_FREEPV) +#define save_op() save_pushptr((void *)(PL_op), SAVEt_OP) + /* * Local variables: * c-indentation-style: bsd |