diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-02-23 11:11:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-02-23 11:11:12 +0000 |
commit | 180488f8452e93d2afa0f62b189be1cc9ac6ba1a (patch) | |
tree | 9383eeeaa7cf0787e424f50616bce24f647f5f52 /mg.c | |
parent | 4115f1412e498d2b0cb499d036610a0e9f8e2c4f (diff) | |
download | perl-180488f8452e93d2afa0f62b189be1cc9ac6ba1a.tar.gz |
Remove get magic from typeglobs. This means that PVGVs holding
typeglobs never need to use SvPVX. This comes at price - typeglobs
were using magic get for their stringificiation, and to pass SvOK(),
so need to make typeglobs SvOK by default (by sucking SVp_SCREAM into
SVf_OK - it's the only flag left), tweak SvSCREAM() to also check
SVp_POK, and teach sv_2[inpu]v how to convert globs.
However, it should free up SvPVX for the next part of the plan to
pointer indirections, and therefore CPU cache pressure.
p4raw-id: //depot/perl@27278
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -1837,21 +1837,6 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg) } int -Perl_magic_getglob(pTHX_ SV *sv, MAGIC *mg) -{ - const U32 wasfake = SvFLAGS(sv) & SVf_FAKE; - PERL_UNUSED_ARG(mg); - - /* FAKE globs can get coerced, so need to turn this off temporarily if it - is on. */ - SvFAKE_off(sv); - gv_efullname3(sv,((GV*)sv), "*"); - SvFLAGS(sv) |= wasfake; - - return 0; -} - -int Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg) { GV* gv; @@ -1859,6 +1844,12 @@ Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg) if (!SvOK(sv)) return 0; + if (SvFLAGS(sv) & SVp_SCREAM + && (SvTYPE(sv) == SVt_PVGV || SvTYPE(sv) == SVt_PVGV)) { + /* We're actually already a typeglob, so don't need the stuff below. + */ + return 0; + } gv = gv_fetchsv(sv, GV_ADD, SVt_PVGV); if (sv == (SV*)gv) return 0; |