On Tue, Sep 12, 2023 at 07:10:45PM +0200, Lukas Mai wrote: > I built perl 5.39.2 with PERL_RC_STACK. One of my modules, > Function::Parameters, started failing: Given that the PERL_RC_STACK work isn't even complete in the perl core yet, I think you're jumping the gun a bit! A lot of CPAN modules, including XS ones, work out of the box - some, depending on circumstances, will require some work. > http://www.cpantesters.org/cpan/report/55055e26-4050-11ee-8bd0-2f0c0197f5f7 > | perl5.39.2: Parameters.xs:1367: register_info: Assertion > `!rpp_stack_is_rc()' failed. > > Is this the expected behavior? > > I got things to work again by manually patching all the PUSHMARK/EXTEND/PUSH > sites with lots of #ifdef PERL_RC_STACK gates: https://github.com/mauke/Function-Parameters/commit/8df472a56657a410d4cd69da2579c527c155085a > > Is there a better way to do this? Should perlcall.pod be amended? Or am I > doing it wrong? In general, things get wrapped so that 'legacy' code can continue using dSP and PUSHs etc. It's possible to rewrite such things using the new rpp_ API, which are designed to work in both PERL_RC_STACK and vanilla environments. But the new rpp_ functions aren't in PPPort yet, so you can't rewrite your code using them. Including them conditionally with millions of #ifdefs is definitely not the approach to take. In rare cases, code may be called from both refcounted stack environments and non-refcounted environments. An example of this is perl's call_sv() and similar, which can be called from anywhere, and so have to be ambidextrous. Thus the body of call_sv() has a few #ifdefs. I don't know about Function::Parameters and in particular how the functions you've been modifying get invoked. But if there is a transition from a refcounted stack to non-refcounted stack somewhere which isn't via a normal XS call from pp_entersub, then it probably needs wrapping so that it's given a temporarily non-refcounted stack to run on and so can run unmodified. But really, you'd be best off waiting until it's complete in core, the rpp_() API has stabilised, and PPPort has been updated. -- Diplomacy is telling someone to go to hell in such a way that they'll look forward to the tripThread Previous | Thread Next