diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-09-19 21:30:18 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-09-19 21:30:18 +0000 |
commit | d8b46c1bb1e2856c8ae13cfa7f0b032537c8f918 (patch) | |
tree | fdb10b355d222b753f3ee2df6dc95f0d7ade8750 /cop.h | |
parent | b3f4d6747e1f3080fd7541acf443f6376f42f81c (diff) | |
download | perl-d8b46c1bb1e2856c8ae13cfa7f0b032537c8f918.tar.gz |
avoid clearing @_ at all for faster subroutine calls; fix bugs
in passing around references to @_, eg C<sub foo { \@_ }>; add
tests for the same
p4raw-id: //depot/perl@4195
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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)) \ |