develooper Front page | perl.perl5.porters | Postings from December 2016

Re: [perl #130318] segfault in Perl_mg_magical (mg.c:144)

Thread Previous | Thread Next
Dave Mitchell
December 27, 2016 11:24
Re: [perl #130318] segfault in Perl_mg_magical (mg.c:144)
Message ID:
On Mon, Dec 26, 2016 at 11:41:52PM +0100, demerphq wrote:
> Ok, color me convinced. 30k lines of pp code sounds less like a
> problem than all the XS code that does the same.

Dealing with XS in the short term is fairly trivial. Have a flag on each
XS CV indicating that it knows about a reference-counted stack. In
pp_entersub(), when calling an XS sub that hasn't got that flag (which
initially is all of them), Copy() the sub's args, so that there are two
copies of all the sub's args on the stack - a reference-counted set which
the XS sub doesn't know about, and a second set which aren't
reference-counted, and the XS sub sees. On return, bump the reference
count of the returned args, decrement the reference count of the passed
args, then shuffle the returned args down the stack.

> Do you have any insight on the other issues I mentioned?

I haven't looked at it yet. Anything involving %^H makes my eyes glaze

Modern art:
    "That's easy, I could have done that!"
    "Ah, but you didn't!"

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About