diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-09 01:29:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-09 01:29:24 +0000 |
commit | 4c040861c885b7446ae0a7ab786cc7994abf83e4 (patch) | |
tree | 5f4c1ef570f4afc4aaa19961cab944695bc4c39f /insnhelper.ci | |
parent | 9f6de20f5879ea8460e74e2b7bf1e989cc6573cb (diff) | |
download | ruby-4c040861c885b7446ae0a7ab786cc7994abf83e4.tar.gz |
* eval.c (rb_invoke_method): check if invoked in function style.
[ruby-core:13245]
* insnhelper.ci (vm_call_cfunc, vm_cfunc_flags): stores and returns VM
calling flags.
* vm.c (rb_vm_cfunc_funcall_p): returns if the current method is
invoked in function style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insnhelper.ci')
-rw-r--r-- | insnhelper.ci | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/insnhelper.ci b/insnhelper.ci index 7e5067b92d..c8d18ce4c8 100644 --- a/insnhelper.ci +++ b/insnhelper.ci @@ -48,7 +48,7 @@ vm_push_frame(rb_thread_t *th, rb_iseq_t *iseq, VALUE type, cfp->sp = sp + 1; cfp->bp = sp + 1; cfp->iseq = iseq; - cfp->flag = VM_FRAME_FLAG(type); + cfp->flag = type; cfp->self = self; cfp->lfp = lfp; cfp->dfp = dfp; @@ -347,15 +347,16 @@ call_cfunc(VALUE (*func)(), VALUE recv, int len, int argc, const VALUE *argv) static inline VALUE vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num, - ID id, VALUE recv, VALUE klass, NODE *mn, rb_block_t *blockptr) + ID id, VALUE recv, VALUE klass, VALUE flag, + NODE *mn, rb_block_t *blockptr) { VALUE val; EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass); { rb_control_frame_t *cfp = - vm_push_frame(th, 0, FRAME_MAGIC_CFUNC, - recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1); + vm_push_frame(th, 0, FRAME_MAGIC_CFUNC | flag * (FRAME_MAGIC_MASK + 1), + recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1); cfp->method_id = id; cfp->method_klass = klass; @@ -374,6 +375,14 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num, return val; } +static int +vm_cfunc_flags(rb_control_frame_t *cfp) +{ + if (RUBYVM_CFUNC_FRAME_P(cfp)) + return cfp->flag / (FRAME_MAGIC_MASK + 1); + return 0; +} + static inline VALUE vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv, VALUE klass, int argc, VALUE *argv) @@ -487,7 +496,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, return Qundef; } case NODE_CFUNC:{ - val = vm_call_cfunc(th, cfp, num, id, recv, klass, node, blockptr); + val = vm_call_cfunc(th, cfp, num, id, recv, klass, flag, node, blockptr); break; } case NODE_ATTRSET:{ |