From 2725f1eb4ceb3a1aba0654c58ebfbb8adef7a9f3 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 6 Jan 2007 00:24:59 +0000 Subject: * insns.def : support direct method dispatch with "send" or "funcall". This means that "obj.send :m" skips "BasicObject#send" invocation (method frame creation, etc) and "obj.m" invokes directly. If you make backtrace, there are no enties of "send" method. * compile.c (iseq_specialized_instruction) : fix to support above * eval.c : ditto (remove "static" from rb_f_send and rb_f_funcall * yarvcore.c : ditto (add a external IDs for compiler) * yarvcore.h : ditto (add a VM_CALL_SEND_BIT macro) * yarvtest/test_method.rb : add tests for above changes * eval.c : remove unused "Kernel#send" declaration git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 07034794a..b1cc31bca 100644 --- a/eval.c +++ b/eval.c @@ -1709,7 +1709,7 @@ send_funcall(int argc, VALUE *argv, VALUE recv, int scope) * k.send :hello, "gentle", "readers" #=> "Hello gentle readers" */ -static VALUE +VALUE rb_f_send(int argc, VALUE *argv, VALUE recv) { int scope = NOEX_PUBLIC; @@ -1736,7 +1736,7 @@ rb_f_send(int argc, VALUE *argv, VALUE recv) * 1.funcall(:puts, "hello") # prints "foo" */ -static VALUE +VALUE rb_f_funcall(int argc, VALUE *argv, VALUE recv) { return send_funcall(argc, argv, recv, NOEX_NOSUPER | NOEX_PRIVATE); @@ -2894,13 +2894,12 @@ Init_eval() rb_define_global_function("global_variables", rb_f_global_variables, 0); /* in variable.c */ rb_define_global_function("local_variables", rb_f_local_variables, 0); - rb_define_method(rb_mKernel, "send", rb_f_send, -1); - rb_define_method(rb_cBasicObject, "send", rb_f_send, -1); rb_define_method(rb_cBasicObject, "__send__", rb_f_send, -1); rb_define_method(rb_cBasicObject, "__send", rb_f_send, -1); rb_define_method(rb_cBasicObject, "funcall", rb_f_funcall, -1); rb_define_method(rb_cBasicObject, "__send!", rb_f_funcall, -1); + rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1); rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1); -- cgit