diff options
author | David Mitchell <davem@iabyn.com> | 2014-02-15 16:38:31 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-02-28 13:42:49 +0000 |
commit | 9075437773fb626926ef91a510090f595c08c653 (patch) | |
tree | 2a599141d66fe1b2d539b871b696565bf8bafafe /gv.c | |
parent | 0c22a733be05b5c1393fc9a2e337dbeed2881596 (diff) | |
download | perl-9075437773fb626926ef91a510090f595c08c653.tar.gz |
gv_check(): use aux flag rather than IsCOW
Currently the SVf_IsCOW flag doesn't have any meaning for HVs,
except that it is used in the specific case of gv_check() to temporarily
mark a stash as being scanned. Since stashes will have the HV_AUX fields,
we can use a flags bit in the new xhv_aux_flags field instead.
This then potentially frees up the SVf_IsCOW for use as a new general flag
bit for *all* HVs (including non-stash ones).
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -2258,23 +2258,30 @@ Perl_gv_check(pTHX_ HV *stash) { dVAR; I32 i; + struct xpvhv_aux *aux; PERL_ARGS_ASSERT_GV_CHECK; if (!HvARRAY(stash)) return; + + assert(SvOOK(stash)); + aux = HvAUX(stash); + for (i = 0; i <= (I32) HvMAX(stash); i++) { const HE *entry; - /* SvIsCOW is unused on HVs, so we can use it to mark stashes we - are currently searching through recursively. */ - SvIsCOW_on(stash); + /* mark stash is being scanned, to avoid recursing */ + aux->xhv_aux_flags |= HvAUXf_SCAN_STASH; for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { GV *gv; HV *hv; if (HeKEY(entry)[HeKLEN(entry)-1] == ':' && (gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv))) { - if (hv != PL_defstash && hv != stash && !SvIsCOW(hv)) + if (hv != PL_defstash && hv != stash + && !(SvOOK(hv) + && (HvAUX(hv)->xhv_aux_flags & HvAUXf_SCAN_STASH)) + ) gv_check(hv); /* nested package */ } else if ( *HeKEY(entry) != '_' @@ -2298,7 +2305,7 @@ Perl_gv_check(pTHX_ HV *stash) HEKfARG(GvNAME_HEK(gv))); } } - SvIsCOW_off(stash); + aux->xhv_aux_flags &= ~HvAUXf_SCAN_STASH; } } |