summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-09-19 21:30:18 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-09-19 21:30:18 +0000
commitd8b46c1bb1e2856c8ae13cfa7f0b032537c8f918 (patch)
treefdb10b355d222b753f3ee2df6dc95f0d7ade8750 /cop.h
parentb3f4d6747e1f3080fd7541acf443f6376f42f81c (diff)
downloadperl-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.h15
1 files changed, 10 insertions, 5 deletions
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)) \