From d8b46c1bb1e2856c8ae13cfa7f0b032537c8f918 Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 19 Sep 1999 21:30:18 +0000 Subject: avoid clearing @_ at all for faster subroutine calls; fix bugs in passing around references to @_, eg C; add tests for the same p4raw-id: //depot/perl@4195 --- cop.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cop.h') diff --git a/cop.h b/cop.h index 6ea045a4a4..e8221b610c 100644 --- a/cop.h +++ b/cop.h @@ -66,17 +66,22 @@ struct block_sub { #define POPSAVEARRAY() \ STMT_START { \ SvREFCNT_dec(GvAV(PL_defgv)); \ - GvAV(PL_defgv) = cxsub.savearray; \ + GvAV(PL_defgv) = cxsub.savearray; \ } STMT_END #endif /* USE_THREADS */ #define POPSUB2() \ if (cxsub.hasargs) { \ POPSAVEARRAY(); \ - /* destroy arg array */ \ - av_clear(cxsub.argarray); \ - AvREAL_off(cxsub.argarray); \ - AvREIFY_on(cxsub.argarray); \ + /* abandon @_ if it got reified */ \ + if (AvREAL(cxsub.argarray)) { \ + SSize_t fill = AvFILLp(cxsub.argarray); \ + SvREFCNT_dec(cxsub.argarray); \ + cxsub.argarray = newAV(); \ + av_extend(cxsub.argarray, fill); \ + AvFLAGS(cxsub.argarray) = AVf_REIFY; \ + PL_curpad[0] = (SV*)cxsub.argarray; \ + } \ } \ if (cxsub.cv) { \ if (!(CvDEPTH(cxsub.cv) = cxsub.olddepth)) \ -- cgit v1.2.1