summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-06-29 23:33:14 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-07-25 23:48:01 -0700
commit6f1b3ab07ea077b8191fe508269d778bc64a5f50 (patch)
tree15598bcbcdebb1ab0af00abc199fbfaa06d069d1 /gv.c
parentf2952d3919aa0fec5fd067ee5668bb4a54a19a2f (diff)
downloadperl-6f1b3ab07ea077b8191fe508269d778bc64a5f50.tar.gz
Allow stash elems to be array refs
These turn into CVs that return the contents of the array. Future commits will make constant.pm use these and also make them inlinable. Even without inlining, these subs are faster, because they are XSUBs: $ time ./perl -Ilib -e 'my @a=1..1000000; sub foo { @a } () = foo for 1..10' real 0m3.725s user 0m3.407s sys 0m0.227s $ time ./perl -Ilib -e 'my @a=1..1000000; BEGIN { $::{foo} = \@a } () = foo for 1..10' real 0m2.153s user 0m1.949s sys 0m0.121s
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index 8449047130..067847cf4f 100644
--- a/gv.c
+++ b/gv.c
@@ -154,7 +154,7 @@ Perl_gv_const_sv(pTHX_ GV *gv)
if (SvTYPE(gv) == SVt_PVGV)
return cv_const_sv(GvCVu(gv));
- return SvROK(gv) ? SvRV(gv) : NULL;
+ return SvROK(gv) && SvTYPE(SvRV(gv)) != SVt_PVAV ? SvRV(gv) : NULL;
}
GP *
@@ -346,7 +346,6 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, U32 flag
if (has_constant) {
/* The constant has to be a simple scalar type. */
switch (SvTYPE(has_constant)) {
- case SVt_PVAV:
case SVt_PVHV:
case SVt_PVCV:
case SVt_PVFM: