This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add inlinable &CORE::functions
authorFather Chrysostomos <sprout@cpan.org>
Sat, 6 Aug 2011 07:20:06 +0000 (00:20 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 14 Aug 2011 19:23:30 +0000 (12:23 -0700)
commit4aaa475724fbbc4ab2427743fa4d07a12e6ce0d9
treed179695a33037243c65c51f5373eaa5a8c95931d
parent9927957a90b2fe6bdb0e2be889b2edcddadea174
Add inlinable &CORE::functions

This commit allows this to work:

  BEGIN { *entangle = \&CORE::tie };
  entangle $foo, $package;

And the entangle call gets inlined as a tie op, the resulting op tree
being indistinguishable.

These subs are not yet callable via &foo syntax or through a refer-
ence.  That will come later, except for some functions, like sort(),
which will probably never support it.

Almost all overridable functions are supported.  These few are not:

  - infix operators
  - not and getprotobynumber (can’t get the precedence right yet;
    prototype problem)
  - dump

Subsequent commits (hopefully!) will deal with those.

How this works:

gv_fetchpvn_flags is extended with hooks to create subs inside the
CORE package.  Those subs are XSUBs (whose C function dies with an
error, for now at least) with a call checker that blows away the
entersub op and replaces it with whatever op the sub represents.

This is slightly inefficient right now, as gv_fetchpvn_flags calls
keyword(), only to have core_prototype call it again.  That will
be fixed in a future refactoring.
MANIFEST
embed.fnc
gv.c
lib/CORE.pod
op.c
pod/perldiag.pod
pod/perlsub.pod
proto.h
t/op/coreinline.t [new file with mode: 0644]