From ad39f3a27b57b8caeb757155ed38da916b768bc1 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 9 Sep 2013 01:59:33 -0700 Subject: [PATCH] Make &xsub and goto &xsub work with tied @_ MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is the only place where tied @_ does not work, and there appears to be no reason why it shouldn’t, apart from the fact that it hasn’t been implemented. Commit 67955e0c was what made &xsub work to begin with. 93965878572 introduced tied arrays and added the comment to pp_entersub saying that @_ is not tiable. goto &xsub has worked since perl 5.000, but 93965878572 did not make it work with tied arrays. --- pp_ctl.c | 24 +++++++++++++++--------- pp_hot.c | 13 +++++++++++-- t/op/tie.t | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index 243bcac..bab301e 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2895,7 +2895,8 @@ PP(pp_goto) /* also pp_dump */ OP* const retop = cx->blk_sub.retop; SV **newsp; I32 gimme; - const SSize_t items = arg ? AvFILLp(arg) + 1 : 0; + const SSize_t items = arg ? AvFILL(arg) + 1 : 0; + const bool m = arg ? SvRMAGICAL(arg) : 0; SV** mark; PERL_UNUSED_VAR(newsp); @@ -2904,20 +2905,25 @@ PP(pp_goto) /* also pp_dump */ /* put GvAV(defgv) back onto stack */ if (items) { EXTEND(SP, items+1); /* @_ could have been extended. */ - Copy(AvARRAY(arg), SP + 1, items, SV*); } mark = SP; - SP += items; - if (items && AvREAL(arg)) { + if (items) { SSize_t index; + bool r = cBOOL(AvREAL(arg)); for (index=0; index