develooper Front page | perl.perl5.porters | Postings from January 2017

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

Thread Previous
Leon Timmermans
January 1, 2017 22:13
Re: [perl #130318] segfault in Perl_mg_magical (mg.c:144)
Message ID:
On Tue, Dec 27, 2016 at 12:24 PM, Dave Mitchell <> wrote:

> 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.

It helps that the most common case (CODE instead of PPCODE, and fixed
length argument list) can easily be handled in ExtUtils::ParseXS.


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