* 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
This commit is contained in:
parent
9f6de20f58
commit
4c040861c8
16
ChangeLog
16
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Fri Nov 9 10:29:21 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Fri Nov 9 10:10:21 2007 Koichi Sasada <ko1@atdot.net>
|
Fri Nov 9 10:10:21 2007 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* cont.c: add rb_context_t#type.
|
* cont.c: add rb_context_t#type.
|
||||||
@ -11,7 +22,9 @@ Fri Nov 9 07:26:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||||||
* random.c: update MT URL.[ruby-core:13305].
|
* random.c: update MT URL.[ruby-core:13305].
|
||||||
|
|
||||||
Thu Nov 8 17:09:55 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
Thu Nov 8 17:09:55 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||||
|
|
||||||
* object.c: improve docs for Object.tap
|
* object.c: improve docs for Object.tap
|
||||||
|
|
||||||
* ChangeLog: fix bogus dates on my previous entries
|
* ChangeLog: fix bogus dates on my previous entries
|
||||||
|
|
||||||
Thu Nov 8 15:13:56 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
Thu Nov 8 15:13:56 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||||
@ -27,7 +40,9 @@ Thu Nov 8 07:54:22 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
|||||||
|
|
||||||
* parse.y: patch, based on Nobu's, work to support \u escapes
|
* parse.y: patch, based on Nobu's, work to support \u escapes
|
||||||
also modifications for better coderange detection
|
also modifications for better coderange detection
|
||||||
|
|
||||||
* test/ruby/test_unicode_escapes.rb: test cases
|
* test/ruby/test_unicode_escapes.rb: test cases
|
||||||
|
|
||||||
* test/ruby/test_mixed_unicode_escapes.rb: mixed encoding test cases
|
* test/ruby/test_mixed_unicode_escapes.rb: mixed encoding test cases
|
||||||
|
|
||||||
Thu Nov 8 07:14:37 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
Thu Nov 8 07:14:37 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||||
@ -37,6 +52,7 @@ Thu Nov 8 07:14:37 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
|||||||
:x==:x is false when x is a multi-byte character.
|
:x==:x is false when x is a multi-byte character.
|
||||||
|
|
||||||
Thu Nov 8 07:04:31 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
Thu Nov 8 07:04:31 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (tr_setup_table, tr_trans): fix test failures
|
* string.c (tr_setup_table, tr_trans): fix test failures
|
||||||
in test/ruby/test_string.rb
|
in test/ruby/test_string.rb
|
||||||
|
|
||||||
|
4
eval.c
4
eval.c
@ -1507,11 +1507,11 @@ rb_f_send(int argc, VALUE *argv, VALUE recv)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_invoke_method(int argc, VALUE *argv, VALUE recv)
|
rb_invoke_method(int argc, VALUE *argv, VALUE recv)
|
||||||
{
|
{
|
||||||
|
int rb_vm_cfunc_funcall_p(rb_control_frame_t *);
|
||||||
int scope = NOEX_PUBLIC;
|
int scope = NOEX_PUBLIC;
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_control_frame_t *cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
|
|
||||||
|
|
||||||
if (SPECIAL_CONST_P(cfp->sp[0])) {
|
if (rb_vm_cfunc_funcall_p(th->cfp)) {
|
||||||
scope = NOEX_NOSUPER | NOEX_PRIVATE;
|
scope = NOEX_NOSUPER | NOEX_PRIVATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ vm_push_frame(rb_thread_t *th, rb_iseq_t *iseq, VALUE type,
|
|||||||
cfp->sp = sp + 1;
|
cfp->sp = sp + 1;
|
||||||
cfp->bp = sp + 1;
|
cfp->bp = sp + 1;
|
||||||
cfp->iseq = iseq;
|
cfp->iseq = iseq;
|
||||||
cfp->flag = VM_FRAME_FLAG(type);
|
cfp->flag = type;
|
||||||
cfp->self = self;
|
cfp->self = self;
|
||||||
cfp->lfp = lfp;
|
cfp->lfp = lfp;
|
||||||
cfp->dfp = dfp;
|
cfp->dfp = dfp;
|
||||||
@ -347,14 +347,15 @@ call_cfunc(VALUE (*func)(), VALUE recv, int len, int argc, const VALUE *argv)
|
|||||||
|
|
||||||
static inline VALUE
|
static inline VALUE
|
||||||
vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num,
|
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;
|
VALUE val;
|
||||||
|
|
||||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass);
|
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, id, klass);
|
||||||
{
|
{
|
||||||
rb_control_frame_t *cfp =
|
rb_control_frame_t *cfp =
|
||||||
vm_push_frame(th, 0, FRAME_MAGIC_CFUNC,
|
vm_push_frame(th, 0, FRAME_MAGIC_CFUNC | flag * (FRAME_MAGIC_MASK + 1),
|
||||||
recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1);
|
recv, (VALUE) blockptr, 0, reg_cfp->sp, 0, 1);
|
||||||
|
|
||||||
cfp->method_id = id;
|
cfp->method_id = id;
|
||||||
@ -374,6 +375,14 @@ vm_call_cfunc(rb_thread_t *th, rb_control_frame_t *reg_cfp, int num,
|
|||||||
return val;
|
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
|
static inline VALUE
|
||||||
vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
|
vm_call_bmethod(rb_thread_t *th, ID id, VALUE procval, VALUE recv,
|
||||||
VALUE klass, int argc, VALUE *argv)
|
VALUE klass, int argc, VALUE *argv)
|
||||||
@ -487,7 +496,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp,
|
|||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
case NODE_CFUNC:{
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_ATTRSET:{
|
case NODE_ATTRSET:{
|
||||||
|
8
vm.c
8
vm.c
@ -1436,6 +1436,14 @@ rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, rb_block_t *blockp
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
rb_vm_cfunc_funcall_p(rb_control_frame_t *cfp)
|
||||||
|
{
|
||||||
|
if (vm_cfunc_flags(cfp) & (VM_CALL_FCALL_BIT | VM_CALL_VCALL_BIT))
|
||||||
|
return Qtrue;
|
||||||
|
return Qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
/* vm */
|
/* vm */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user