From: Andy Lester Date: Thu, 10 Mar 2005 15:17:28 +0000 (-0600) Subject: pad_push numero three-o X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2601929893f334f18dbc48652b91b4acab6e8915;p=p5sagit%2Fp5-mst-13.2.git pad_push numero three-o Message-ID: <20050310211728.GC32386@petdance.com> p4raw-id: //depot/perl@24023 --- diff --git a/embed.fnc b/embed.fnc index 6fd4a1d..fc400ee 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1363,7 +1363,7 @@ pd |void |do_dump_pad |I32 level|PerlIO *file \ |PADLIST *padlist|int full pd |void |pad_fixup_inner_anons|PADLIST *padlist|CV *old_cv|CV *new_cv -pd |void |pad_push |PADLIST *padlist|int depth|int has_args +pd |void |pad_push |PADLIST *padlist|int depth #if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT) sd |PADOFFSET|pad_findlex |char *name|CV* cv|U32 seq|int warn \ diff --git a/embed.h b/embed.h index 00ae7a7..c258e8f 100644 --- a/embed.h +++ b/embed.h @@ -4683,7 +4683,7 @@ #define pad_fixup_inner_anons(a,b,c) Perl_pad_fixup_inner_anons(aTHX_ a,b,c) #endif #ifdef PERL_CORE -#define pad_push(a,b,c) Perl_pad_push(aTHX_ a,b,c) +#define pad_push(a,b) Perl_pad_push(aTHX_ a,b) #endif #if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE diff --git a/pad.c b/pad.c index 0c00cff..1330894 100644 --- a/pad.c +++ b/pad.c @@ -1537,17 +1537,14 @@ Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv) =for apidoc pad_push Push a new pad frame onto the padlist, unless there's already a pad at -this depth, in which case don't bother creating a new one. -If has_args is true, give the new pad an @_ in slot zero. +this depth, in which case don't bother creating a new one. Then give +the new pad an @_ in slot zero. =cut */ -/* XXX pad_push is now always called with has_args == 1. Get rid of - * this arg at some point */ - void -Perl_pad_push(pTHX_ PADLIST *padlist, int depth, int has_args) +Perl_pad_push(pTHX_ PADLIST *padlist, int depth) { if (depth <= AvFILLp(padlist)) return; @@ -1557,41 +1554,44 @@ Perl_pad_push(pTHX_ PADLIST *padlist, int depth, int has_args) AV *newpad = newAV(); SV **oldpad = AvARRAY(svp[depth-1]); I32 ix = AvFILLp((AV*)svp[1]); - I32 names_fill = AvFILLp((AV*)svp[0]); + const I32 names_fill = AvFILLp((AV*)svp[0]); SV** names = AvARRAY(svp[0]); - SV* sv; + AV *av; + for ( ;ix > 0; ix--) { if (names_fill >= ix && names[ix] != &PL_sv_undef) { - char *name = SvPVX(names[ix]); - if ((SvFLAGS(names[ix]) & SVf_FAKE) || *name == '&') { + const char sigil = SvPVX(names[ix])[0]; + if ((SvFLAGS(names[ix]) & SVf_FAKE) || sigil == '&') { /* outer lexical or anon code */ av_store(newpad, ix, SvREFCNT_inc(oldpad[ix])); } else { /* our own lexical */ - if (*name == '@') - av_store(newpad, ix, sv = (SV*)newAV()); - else if (*name == '%') - av_store(newpad, ix, sv = (SV*)newHV()); + SV *sv; + if (sigil == '@') + sv = (SV*)newAV(); + else if (sigil == '%') + sv = (SV*)newHV(); else - av_store(newpad, ix, sv = NEWSV(0, 0)); + sv = NEWSV(0, 0); + av_store(newpad, ix, sv); SvPADMY_on(sv); } } else if (IS_PADGV(oldpad[ix]) || IS_PADCONST(oldpad[ix])) { - av_store(newpad, ix, sv = SvREFCNT_inc(oldpad[ix])); + av_store(newpad, ix, SvREFCNT_inc(oldpad[ix])); } else { /* save temporaries on recursion? */ - av_store(newpad, ix, sv = NEWSV(0, 0)); + SV *sv = NEWSV(0, 0); + av_store(newpad, ix, sv); SvPADTMP_on(sv); } } - if (has_args) { - AV* av = newAV(); - av_extend(av, 0); - av_store(newpad, 0, (SV*)av); - AvFLAGS(av) = AVf_REIFY; - } + av = newAV(); + av_extend(av, 0); + av_store(newpad, 0, (SV*)av); + AvFLAGS(av) = AVf_REIFY; + av_store(padlist, depth, (SV*)newpad); AvFILLp(padlist) = depth; } diff --git a/pod/perlintern.pod b/pod/perlintern.pod index 48a433a..d50cbbd 100644 --- a/pod/perlintern.pod +++ b/pod/perlintern.pod @@ -697,10 +697,10 @@ Found in file pad.c =item pad_push Push a new pad frame onto the padlist, unless there's already a pad at -this depth, in which case don't bother creating a new one. -If has_args is true, give the new pad an @_ in slot zero. +this depth, in which case don't bother creating a new one. Then give +the new pad an @_ in slot zero. - void pad_push(PADLIST *padlist, int depth, int has_args) + void pad_push(PADLIST *padlist, int depth) =for hackers Found in file pad.c diff --git a/pp_ctl.c b/pp_ctl.c index 829b655..fe03eeb 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2387,7 +2387,7 @@ PP(pp_goto) else { if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION)) sub_crush_depth(cv); - pad_push(padlist, CvDEPTH(cv), 1); + pad_push(padlist, CvDEPTH(cv)); } PAD_SET_CUR(padlist, CvDEPTH(cv)); if (cx->blk_sub.hasargs) diff --git a/pp_hot.c b/pp_hot.c index 37c8f9d..a511772 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2703,7 +2703,7 @@ PP(pp_entersub) */ if (CvDEPTH(cv) >= 2) { PERL_STACK_OVERFLOW_CHECK(); - pad_push(padlist, CvDEPTH(cv), 1); + pad_push(padlist, CvDEPTH(cv)); } PAD_SET_CUR(padlist, CvDEPTH(cv)); if (hasargs) diff --git a/proto.h b/proto.h index 2a21592..8ab2155 100644 --- a/proto.h +++ b/proto.h @@ -1306,7 +1306,7 @@ PERL_CALLCONV void Perl_pad_tidy(pTHX_ padtidy_type type); PERL_CALLCONV void Perl_do_dump_pad(pTHX_ I32 level, PerlIO *file, PADLIST *padlist, int full); PERL_CALLCONV void Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv); -PERL_CALLCONV void Perl_pad_push(pTHX_ PADLIST *padlist, int depth, int has_args); +PERL_CALLCONV void Perl_pad_push(pTHX_ PADLIST *padlist, int depth); #if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT) STATIC PADOFFSET S_pad_findlex(pTHX_ char *name, CV* cv, U32 seq, int warn, SV** out_capture, SV** out_name_sv, int *out_flags);