Dual-Life/autodie

Implement wrapper subs in C or XS

nthykier opened this issue · 3 comments

The idea to implement autodie in C was mentioned in evalEmpire/perl5i#102. While it may just improve the speed in itself, it may also open the door to cache subs much more aggressively.
According to [1], XS are invisible in "caller" so a lot of issues we have preventing reuse /might/ just disappear once the checker sub "disappears" from the call stack.

~Niels

[1] http://perl5.git.perl.org/perl.git/commitdiff/1d56df500dec0bf9de438b0fa225eb363b006dcf

pjf commented

If we have skilled C/XS folks, we may even be able to wrap say/print. :)

On 2013-09-21 04:40, Paul Fenwick wrote:

If we have skilled C/XS folks, we may even be able to wrap say/print. :)

I think to wrap say or print, we pretty much have to swipe it out at the
op-code level. The problem with these is that there is no prototype
that can describe their call interface, so we need perl's parse to
"translate" the call for us and the substitute print with "checked_print".
That said, if/once we start doing XS stuff, we can probably get away
with doing this for all CORE subs we check. I am pretty sure we can do
this in a resuable manner[1] and with less runtime overhead than PP.

~Niels

[1] In particular, if we are messing with op tree, we won't need leak
guards.

For reference, @schwern wrote some code for including autodie behaviour directly in perl code (see evalEmpire/parfait/issues/16 and https://github.com/evalEmpire/perl5ic/tree/autodie)