From dc44b362e1e298e327be398f06def916f8546ac2 Mon Sep 17 00:00:00 2001 From: Richard Leach Date: Fri, 31 Jul 2020 19:25:27 +0100 Subject: [PATCH] Move PL_curstack code from Perl_av_extend_guts to Perl_stack_grow --- av.c | 6 ------ scope.c | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/av.c b/av.c index ed67df19de99..96c6f03964ff 100644 --- a/av.c +++ b/av.c @@ -169,12 +169,6 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp, to_null += newmax - *maxp; *maxp = newmax; - /* See GH#18014 for discussion of when this might be needed: */ - if (av == PL_curstack) { /* Oops, grew stack (via av_store()?) */ - PL_stack_sp = *allocp + (PL_stack_sp - PL_stack_base); - PL_stack_base = *allocp; - PL_stack_max = PL_stack_base + newmax; - } } else { /* there is no SV* array yet */ *maxp = key < 3 ? 3 : key; { diff --git a/scope.c b/scope.c index cea1500e6a62..22ec8d4aa25a 100644 --- a/scope.c +++ b/scope.c @@ -56,6 +56,11 @@ Perl_stack_grow(pTHX_ SV **sp, SV **p, SSize_t n) Perl_croak(aTHX_ "Out of memory during stack extend"); av_extend(PL_curstack, current + n + extra); + + PL_stack_sp = AvALLOC(PL_curstack) + (PL_stack_sp - PL_stack_base); + PL_stack_base = AvALLOC(PL_curstack); + PL_stack_max = PL_stack_base + AvMAX(PL_curstack); + #ifdef DEBUGGING PL_curstackinfo->si_stack_hwm = current + n + extra; #endif