-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overload stringify 5.18-5.22 #219
Comments
This started failing with 5.18. Maybe the root-cause is my workaround for the broken %version:: SvSTASH. See https://rt.cpan.org/Ticket/Display.html?id=81635 Update: It is not. Work in the branch |
Right. You reported the bug against version except Devel::Peek and version are both perl as upstream. https://rt.cpan.org/Public/Bug/Display.html?id=107459 |
Bisected in blead. c07f9fb2c73bebcf70fabbf464c0c3452af4fcbf is the first bad commit
:100644 100644 2d1d887fe8b4256b2b5682dc6d26065f12ab5a6d be2038f4e7cdaf2d918c5df419348fca09290ab0 M mro.c |
Output at offending commit: cd t && (rm -f perl; /bin/ln -s ../perl perl) |
Reported to upstream. https://rt.perl.org/Public/Bug/Display.html?id=126410 |
Even with the patch applied to upstream, the original problem continues to be an issue so I think the upstream Devel::Peek regression is probably a distraction from the primary issue. |
Test results with fix sent to upstream compiled in to perl 5.22.0 $>perlcc -e'package OverloadTest; use overload q{""} => sub { ${$_[0]} }; package main; my $foo = bless \(my $bar = "ok"), "OverloadTest"; print $foo."\n";' ; ./a.out
./a.out
/usr/local/cpanel/3rdparty/perl/522-debug/bin/perlcc: Unexpected compiler output
[WARNING] skip SvSTASH for overloaded HV %Errno:: flags=0x3280000c
[WARNING] unknown (HV*)&sv_list[455] found in @static_free
OverloadTest=SCALAR(0x8112fb0) |
Todd to bisect this today. |
apply the patch from [perl #126410] for my_curse. improve the logic to detect this crash, so it should work now also with unpatched perls >= O3 GH #219
Patched my_curse for -fno-destruct (-O3) so we don't even need the core patch on older perls. |
diff --git a/sv.c b/sv.c
index 0c940cb..1e7f4d2 100644
--- a/sv.c
+++ b/sv.c
@@ -9518,11 +9518,6 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *const stash)
SvUPGRADE(tmpRef, SVt_PVMG);
SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash)));
- if (Gv_AMG(stash))
- SvAMAGIC_on(sv);
- else
- (void)SvAMAGIC_off(sv);
-
if(SvSMAGICAL(tmpRef))
if(mg_find(tmpRef, PERL_MAGIC_ext) || mg_find(tmpRef, PERL_MAGIC_uvar))
mg_set(tmpRef); |
Uh, now that's interesting and should be pretty simple to fix, thanks! |
apply the patch from [perl #126410] for my_curse. improve the logic to detect this crash, so it should work now also with unpatched perls >= O3 GH #219
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot). Note that make_sv_object already mortalizes. Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
Apply the patch from [perl #126410] for my_curse. See GH rurban#219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
a workaround for it is to adjust ISA at run time (using the overload branch) #!perl
package OverloadTest;
use overload '""' => sub { ${$_[0]} };
package main;
my $foo = bless \(my $bar = "ok" ), "OverloadTest";
INIT {
push @OverloadTest::ISA, 'overload';
}
print "$foo\n";
|
This is because the HvMROMETA (xpvhv_aux) is updated for the stash when @isa is changed. We need to start capturing and saving xpvhv_aux for all stashes for now on. This also would probably take away the need to set 'c3' on classes during XS init since this is simply populating that data. |
this dirty commit fixes the overload |
@rurban While that does fix things, the correct solution is to save and properly attach xpvhv_aux where necessary. From the looks of it, the data is static? |
No, it's dynamic. I only save it for RITER/EITER, see there. However the code in I tested a static |
Fixed with 1.52_18, thanks @atoomic |
Apply the patch from [perl #126410] for my_curse. See GH #219 5.18 AMG has no SvSTASH It still crashed with %version. Provide our own B::HV::SvSTASH method and check against an invalid STASH ptr (< arenaroot).
confirmed. add 5.14->5.22 symlinks for same testfiles. but there are not many. We should add version checks/skips into the tests
and fix -DMG issues with wrong CV stashes. Harmonize gv_stashpv, always using const strings. Also force saving the @isa before calling gv_stashpvn() so that gv_stashpvn can correctly populate its stashcache. Fixes GH rurban#219 and GH rurban#172 for 5.18-5.22 (cherry picked from commit 02eb705) Signed-off-by: Nicolas Rochelemagne <[email protected]>
confirmed. add 5.14->5.22 symlinks for same testfiles. but there are not many. We should add version checks/skips into the tests
confirmed. add 5.14->5.22 symlinks for same testfiles. but there are not many. We should add version checks/skips into the tests
confirmed. add 5.14->5.22 symlinks for same testfiles. but there are not many. We should add version checks/skips into the tests
confirmed. add 5.14->5.22 symlinks for same testfiles. but there are not many. We should add version checks/skips into the tests
Apply the patch from [perl #126410] for my_curse. See GH rurban#219 Fix a couple of sprintf names. Initialize overload cache for AMAGIC. WIP rurban#219 Using the patched B::HV::SvSTASH does not help yet, it rather regresses. So disable it for now, until it can be used. (cherry picked from commit ce25407) Signed-off-by: Nicolas Rochelemagne <[email protected]>
These all appear to be PAD related. Since we're saving the PAD statically with an immortal flag, we're not having issues any more. #26 rurban#219 rurban#277
Env:
perl 5.20.2
B::C using bc522 with HEAD @734e776 ( cannot use 23016e1 with 5.20 )
Steps to reproduce
Seems a regression as this is working on 5.14
The text was updated successfully, but these errors were encountered: