diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-08-06 00:20:06 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-08-14 12:23:30 -0700 |
commit | 4aaa475724fbbc4ab2427743fa4d07a12e6ce0d9 (patch) | |
tree | d179695a33037243c65c51f5373eaa5a8c95931d /embed.fnc | |
parent | 9927957a90b2fe6bdb0e2be889b2edcddadea174 (diff) | |
download | perl-4aaa475724fbbc4ab2427743fa4d07a12e6ce0d9.tar.gz |
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.
Diffstat (limited to 'embed.fnc')
-rw-r--r-- | embed.fnc | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -880,6 +880,8 @@ Apd |CV* |rv2cv_op_cv |NN OP *cvop|U32 flags Apd |OP* |ck_entersub_args_list|NN OP *entersubop Apd |OP* |ck_entersub_args_proto|NN OP *entersubop|NN GV *namegv|NN SV *protosv Apd |OP* |ck_entersub_args_proto_or_list|NN OP *entersubop|NN GV *namegv|NN SV *protosv +po |OP* |ck_entersub_args_core|NN OP *entersubop|NN GV *namegv \ + |NN SV *protosv Apd |void |cv_get_call_checker|NN CV *cv|NN Perl_call_checker *ckfun_p|NN SV **ckobj_p Apd |void |cv_set_call_checker|NN CV *cv|NN Perl_call_checker ckfun|NN SV *ckobj Apa |PERL_SI*|new_stackinfo|I32 stitems|I32 cxitems @@ -1645,7 +1647,7 @@ s |void |bad_type |I32 n|NN const char *t|NN const char *name|NN const OP *kid s |void |no_bareword_allowed|NN OP *o sR |OP* |no_fh_allowed|NN OP *o sR |OP* |too_few_arguments|NN OP *o|NN const char* name -sR |OP* |too_many_arguments|NN OP *o|NN const char* name +s |OP* |too_many_arguments|NN OP *o|NN const char* name s |bool |looks_like_bool|NN const OP* o s |OP* |newGIVWHENOP |NULLOK OP* cond|NN OP *block \ |I32 enter_opcode|I32 leave_opcode \ |