diff options
-rw-r--r-- | embed.h | 3 | ||||
-rwxr-xr-x | embed.pl | 1 | ||||
-rw-r--r-- | global.sym | 1 | ||||
-rw-r--r-- | objXSUB.h | 4 | ||||
-rw-r--r-- | pp.h | 14 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | scope.c | 13 | ||||
-rw-r--r-- | sv.c | 24 |
8 files changed, 33 insertions, 30 deletions
@@ -931,6 +931,7 @@ #define swash_init Perl_swash_init #define taint_env Perl_taint_env #define taint_proper Perl_taint_proper +#define tmps_grow Perl_tmps_grow #define to_uni_lower Perl_to_uni_lower #define to_uni_lower_lc Perl_to_uni_lower_lc #define to_uni_title Perl_to_uni_title @@ -2041,7 +2042,6 @@ #define sv_len_utf8 CPerlObj::Perl_sv_len_utf8 #define sv_magic CPerlObj::Perl_sv_magic #define sv_mortalcopy CPerlObj::Perl_sv_mortalcopy -#define sv_mortalgrow CPerlObj::Perl_sv_mortalgrow #define sv_ncmp CPerlObj::Perl_sv_ncmp #define sv_newmortal CPerlObj::Perl_sv_newmortal #define sv_newref CPerlObj::Perl_sv_newref @@ -2093,6 +2093,7 @@ #define swash_init CPerlObj::Perl_swash_init #define taint_env CPerlObj::Perl_taint_env #define taint_proper CPerlObj::Perl_taint_proper +#define tmps_grow CPerlObj::Perl_tmps_grow #define to_uni_lower CPerlObj::Perl_to_uni_lower #define to_uni_lower_lc CPerlObj::Perl_to_uni_lower_lc #define to_uni_title CPerlObj::Perl_to_uni_title @@ -225,7 +225,6 @@ my @staticfuncs = qw( del_xnv del_xpv del_xrv - sv_mortalgrow sv_unglob avhv_index_sv do_report_used diff --git a/global.sym b/global.sym index 881ee764bc..e7d1e365e4 100644 --- a/global.sym +++ b/global.sym @@ -578,6 +578,7 @@ swash_fetch swash_init taint_env taint_proper +tmps_grow to_uni_lower to_uni_lower_lc to_uni_title @@ -2947,8 +2947,6 @@ #define sv_magic pPerl->Perl_sv_magic #undef sv_mortalcopy #define sv_mortalcopy pPerl->Perl_sv_mortalcopy -#undef sv_mortalgrow -#define sv_mortalgrow pPerl->Perl_sv_mortalgrow #undef sv_ncmp #define sv_ncmp pPerl->Perl_sv_ncmp #undef sv_newmortal @@ -3051,6 +3049,8 @@ #define taint_env pPerl->Perl_taint_env #undef taint_proper #define taint_proper pPerl->Perl_taint_proper +#undef tmps_grow +#define tmps_grow pPerl->Perl_tmps_grow #undef to_uni_lower #define to_uni_lower pPerl->Perl_to_uni_lower #undef to_uni_lower_lc @@ -155,18 +155,18 @@ #define SWITCHSTACK(f,t) \ STMT_START { \ - AvFILLp(f) = sp - PL_stack_base; \ + AvFILLp(f) = sp - PL_stack_base; \ PL_stack_base = AvARRAY(t); \ - PL_stack_max = PL_stack_base + AvMAX(t); \ + PL_stack_max = PL_stack_base + AvMAX(t); \ sp = PL_stack_sp = PL_stack_base + AvFILLp(t); \ - PL_curstack = t; \ + PL_curstack = t; \ } STMT_END #define EXTEND_MORTAL(n) \ - STMT_START { \ - if (PL_tmps_ix + (n) >= PL_tmps_max) \ - Renew(PL_tmps_stack, PL_tmps_max = PL_tmps_ix + (n) + 1, SV*); \ - } STMT_END + STMT_START { \ + if (PL_tmps_ix + (n) >= PL_tmps_max) \ + tmps_grow(n); \ + } STMT_END #define AMGf_noright 1 #define AMGf_noleft 2 @@ -715,7 +715,6 @@ void del_xiv _((XPVIV* p)); void del_xnv _((XPVNV* p)); void del_xpv _((XPV* p)); void del_xrv _((XRV* p)); -void sv_mortalgrow _((void)); void sv_unglob _((SV* sv)); I32 avhv_index_sv _((SV* sv)); @@ -967,3 +966,5 @@ VIRTUAL void reginitcolors _((void)); VIRTUAL char* sv_2pv_nolen _((SV* sv)); VIRTUAL char* sv_pv _((SV *sv)); VIRTUAL void sv_force_normal _((SV *sv)); +VIRTUAL void tmps_grow _((I32 n)); + @@ -135,6 +135,19 @@ savestack_grow(void) #undef GROW void +tmps_grow(I32 n) +{ + dTHR; +#ifndef STRESS_REALLOC + if (n < 128) + n = (PL_tmps_max < 512) ? 128 : 512; +#endif + PL_tmps_max = PL_tmps_ix + n + 1; + Renew(PL_tmps_stack, PL_tmps_max, SV*); +} + + +void free_tmps(void) { dTHR; @@ -57,7 +57,6 @@ static void del_xiv _((XPVIV* p)); static void del_xnv _((XPVNV* p)); static void del_xpv _((XPV* p)); static void del_xrv _((XRV* p)); -static void sv_mortalgrow _((void)); static void sv_unglob _((SV* sv)); #ifndef PURIFY @@ -3551,14 +3550,6 @@ sv_dec(register SV *sv) * hopefully we won't free it until it has been assigned to a * permanent location. */ -STATIC void -sv_mortalgrow(void) -{ - dTHR; - PL_tmps_max += (PL_tmps_max < 512) ? 128 : 512; - Renew(PL_tmps_stack, PL_tmps_max, SV*); -} - SV * sv_mortalcopy(SV *oldstr) { @@ -3570,9 +3561,8 @@ sv_mortalcopy(SV *oldstr) SvREFCNT(sv) = 1; SvFLAGS(sv) = 0; sv_setsv(sv,oldstr); - if (++PL_tmps_ix >= PL_tmps_max) - sv_mortalgrow(); - PL_tmps_stack[PL_tmps_ix] = sv; + EXTEND_MORTAL(1); + PL_tmps_stack[++PL_tmps_ix] = sv; SvTEMP_on(sv); return sv; } @@ -3587,9 +3577,8 @@ sv_newmortal(void) SvANY(sv) = 0; SvREFCNT(sv) = 1; SvFLAGS(sv) = SVs_TEMP; - if (++PL_tmps_ix >= PL_tmps_max) - sv_mortalgrow(); - PL_tmps_stack[PL_tmps_ix] = sv; + EXTEND_MORTAL(1); + PL_tmps_stack[++PL_tmps_ix] = sv; return sv; } @@ -3603,9 +3592,8 @@ sv_2mortal(register SV *sv) return sv; if (SvREADONLY(sv) && SvIMMORTAL(sv)) return sv; - if (++PL_tmps_ix >= PL_tmps_max) - sv_mortalgrow(); - PL_tmps_stack[PL_tmps_ix] = sv; + EXTEND_MORTAL(1); + PL_tmps_stack[++PL_tmps_ix] = sv; SvTEMP_on(sv); return sv; } |