diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-07 17:35:10 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-15 22:44:59 -0700 |
commit | b290562ef436d5316a2f75513def7f4f18c4ef34 (patch) | |
tree | cf17255810711fb72c2702959076b99265b56068 /pad.c | |
parent | 97b03d64e557578d3dbfeb6e6ca37ba57d57e858 (diff) | |
download | perl-b290562ef436d5316a2f75513def7f4f18c4ef34.tar.gz |
Allow CVs to point to HEKs rather than GVs
This will allow named lexical subs to exist independent of GVs.
Diffstat (limited to 'pad.c')
-rw-r--r-- | pad.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -381,7 +381,8 @@ Perl_cv_undef(pTHX_ CV *cv) #endif SvPOK_off(MUTABLE_SV(cv)); /* forget prototype */ sv_unmagic((SV *)cv, PERL_MAGIC_checkcall); - CvGV_set(cv, NULL); + if (CvNAMED(cv)) unshare_hek(CvNAME_HEK(cv)); + else CvGV_set(cv, NULL); /* This statement and the subsequence if block was pad_undef(). */ pad_peg("pad_undef"); @@ -1989,7 +1990,9 @@ Perl_cv_clone(pTHX_ CV *proto) CvFILE(cv) = CvDYNFILE(proto) ? savepv(CvFILE(proto)) : CvFILE(proto); - CvGV_set(cv,CvGV(proto)); + if (CvNAMED(proto)) + SvANY(cv)->xcv_gv_u.xcv_hek = share_hek_hek(CvNAME_HEK(proto)); + else CvGV_set(cv,CvGV(proto)); CvSTASH_set(cv, CvSTASH(proto)); OP_REFCNT_LOCK; CvROOT(cv) = OpREFCNT_inc(CvROOT(proto)); |