summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-05-18 08:52:02 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-21 18:09:26 -0700
commit9299023c08583d1430e423584af75641cf0e1513 (patch)
treece7ab80e80de3276ffb53e79334bb47ea80ec1a1 /sv.h
parent0adc25b0c21a5e7b4a9dedeed0ece7327302ac9a (diff)
downloadperl-9299023c08583d1430e423584af75641cf0e1513.tar.gz
sv.h: Turn off AMAGIC flag in Gv_AMG
This makes no functional changes. If a stash has its AMAGIC flag on, then when the overload caches are updated we can turn off the flag if it turns out that there is no overloading. Gv_AMG is the easiest place to unset this flag, as Gv_AMupdate has ‘return 0’ in more than one place. This is for efficiency’s sake, as an object that inherits overloading but then loses it through @ISA changes will still have to go through extra checks due to SvAMAGIC returning true. This also offsets an inefficiency to be introduced in later commits: changes to @ISA will set the AMAGIC flag.
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.h b/sv.h
index c3e6c5a9f5..8d09ccbd09 100644
--- a/sv.h
+++ b/sv.h
@@ -923,7 +923,8 @@ the scalar's value cannot change unless written to.
#define SvGAMAGIC(sv) (SvGMAGICAL(sv) || SvAMAGIC(sv))
-#define Gv_AMG(stash) Gv_AMupdate(stash, FALSE)
+#define Gv_AMG(stash) \
+ (Gv_AMupdate(stash,FALSE) ? 1 : (HvAMAGIC_off(stash), 0))
#define SvWEAKREF(sv) ((SvFLAGS(sv) & (SVf_ROK|SVprv_WEAKREF)) \
== (SVf_ROK|SVprv_WEAKREF))