summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-05-17 22:26:20 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-21 18:09:24 -0700
commita1cd65be3e8d2e7a6b4edef2ff5eee74e79cf497 (patch)
treee32a148ea20b616ffb7bf2a8262e2bff9c9deb97 /gv.c
parent54f6ba105424d583f3ad66ad05790975c5d7a86d (diff)
downloadperl-a1cd65be3e8d2e7a6b4edef2ff5eee74e79cf497.tar.gz
Move SvAMAGIC flag from object to stash
By putting the flag on the stash, we can allow the overloaded status of all objects of a particular class to change without having to change the flag on every object (which would require traversing arenas or keeping caches). This partially fixes bug #112708, in that objects that existed before their class had any overloading will start working after overloading is introduced if other objects are blessed into that class. Without blessings of other objects, they still don’t work yet. The fix for that is yet to come.... This was also a good excuse for deleting a comment that contained two typos. :-)
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gv.c b/gv.c
index f51fe0584a..395cba52e7 100644
--- a/gv.c
+++ b/gv.c
@@ -2691,12 +2691,8 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags)
*/
SV* const newref = newSVsv(tmpRef);
SvOBJECT_on(newref);
- /* As a bit of a source compatibility hack, SvAMAGIC() and
- friends dereference an RV, to behave the same was as when
- overloading was stored on the reference, not the referant.
- Hence we can't use SvAMAGIC_on()
- */
- SvFLAGS(newref) |= SVf_AMAGIC;
+ /* No need to do SvAMAGIC_on here, as SvAMAGIC macros
+ delegate to the stash. */
SvSTASH_set(newref, MUTABLE_HV(SvREFCNT_inc(SvSTASH(tmpRef))));
return newref;
}