diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1999-10-02 11:11:44 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1999-10-02 11:11:44 +0000 |
commit | 33d8f7c1afe01d04914301ea81b4771b23fc2612 (patch) | |
tree | 72cb8a4a39d47dedec2343de539792defccac948 /pp_hot.c | |
parent | 5bc28da93666e223bb56098f72517273bc8bcbf9 (diff) | |
parent | 9741dab02becad0550bba7d5ca9e59f8ac608b2d (diff) | |
download | perl-33d8f7c1afe01d04914301ea81b4771b23fc2612.tar.gz |
Incremental merge of mainline
p4raw-id: //depot/utfperl@4286
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 43 |
1 files changed, 26 insertions, 17 deletions
@@ -233,7 +233,7 @@ PP(pp_preinc) { djSP; if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV) - Perl_croak(aTHX_ PL_no_modify); + DIE(aTHX_ PL_no_modify); if (SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) && SvIVX(TOPs) != IV_MAX) { @@ -1644,7 +1644,7 @@ PP(pp_subst) if (SvREADONLY(TARG) || (SvTYPE(TARG) > SVt_PVLV && !(SvTYPE(TARG) == SVt_PVGV && SvFAKE(TARG)))) - Perl_croak(aTHX_ PL_no_modify); + DIE(aTHX_ PL_no_modify); PUTBACK; s = SvPV(TARG, len); @@ -2013,36 +2013,49 @@ PP(pp_leavesublv) /* Here we go for robustness, not for speed, so we change all * the refcounts so the caller gets a live guy. Cannot set * TEMP, so sv_2mortal is out of question. */ - if (!CvLVALUE(cxsub.cv)) - Perl_croak(aTHX_ "Can't modify non-lvalue subroutine call"); + if (!CvLVALUE(cxsub.cv)) { + POPSUB2(); + PL_curpm = newpm; + DIE(aTHX_ "Can't modify non-lvalue subroutine call"); + } if (gimme == G_SCALAR) { MARK = newsp + 1; EXTEND_MORTAL(1); if (MARK == SP) { - if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) - Perl_croak(aTHX_ "Can't return a %s from lvalue subroutine", + if (SvFLAGS(TOPs) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) { + POPSUB2(); + PL_curpm = newpm; + DIE(aTHX_ "Can't return a %s from lvalue subroutine", SvREADONLY(TOPs) ? "readonly value" : "temporary"); + } else { /* Can be a localized value * subject to deletion. */ PL_tmps_stack[++PL_tmps_ix] = *mark; SvREFCNT_inc(*mark); } } - else /* Should not happen? */ - Perl_croak(aTHX_ "%s returned from lvalue subroutine in scalar context", + else { /* Should not happen? */ + POPSUB2(); + PL_curpm = newpm; + DIE(aTHX_ "%s returned from lvalue subroutine in scalar context", (MARK > SP ? "Empty array" : "Array")); + } SP = MARK; } else if (gimme == G_ARRAY) { EXTEND_MORTAL(SP - newsp); for (mark = newsp + 1; mark <= SP; mark++) { - if (SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) - /* Might be flattened array after $#array = */ - Perl_croak(aTHX_ "Can't return %s from lvalue subroutine", + if (SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) { + /* Might be flattened array after $#array = */ + PUTBACK; + POPSUB2(); + PL_curpm = newpm; + DIE(aTHX_ "Can't return %s from lvalue subroutine", (*mark != &PL_sv_undef) ? (SvREADONLY(TOPs) ? "a readonly value" : "a temporary") : "an uninitialized value"); + } else { mortalize: /* Can be a localized value subject to deletion. */ @@ -2257,7 +2270,7 @@ try_autoload: || !(sv = AvARRAY(av)[0])) { MUTEX_UNLOCK(CvMUTEXP(cv)); - Perl_croak(aTHX_ "no argument for locked method call"); + DIE(aTHX_ "no argument for locked method call"); } } if (SvROK(sv)) @@ -2521,11 +2534,7 @@ try_autoload: "%p entersub preparing @_\n", thr)); #endif av = (AV*)PL_curpad[0]; - if (AvREAL(av)) { - av_clear(av); - AvREAL_off(av); - AvREIFY_on(av); - } + assert(!AvREAL(av)); #ifndef USE_THREADS cx->blk_sub.savearray = GvAV(PL_defgv); GvAV(PL_defgv) = (AV*)SvREFCNT_inc(av); |