From f4dbc7a3849988ebe75d3e1031aa50441347c497 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 19 Oct 2012 10:38:30 +0000 Subject: * method.h (rb_method_cfunc_t::invoker): add new field (func ptr) `invoker'. `invoker' function invoke cfunc body (rb_method_cfunc_t::func). `invoker' is set at method definition timing. With this change, the big `switch' (branch) in `call_cfunc()' is no longer needed. However, the performance benefit is only a bit. * vm_core.h (rb_call_info_t::aux::func): add a new field to store cfunc body function pointer. * vm_method.c (call_cfunc_invoker_func): add a new function which returns a suitable invoke function. * vm_method.c (setup_method_cfunc_struct): added. * vm_method.c (rb_add_method): fix to set `invoker'. * vm_eval.c (vm_call0_body): catch up above changes. * vm_insnhelper.c (call_cfunc): removed. * vm_insnhelper.c (vm_call_cfunc): fix to call cfunc body with `invoker' function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- method.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'method.h') diff --git a/method.h b/method.h index cc7b51dddb..ba5899ca93 100644 --- a/method.h +++ b/method.h @@ -45,8 +45,11 @@ typedef enum { VM_METHOD_TYPE_CFUNC_FRAMELESS } rb_method_type_t; +struct rb_call_info_struct; + typedef struct rb_method_cfunc_struct { VALUE (*func)(ANYARGS); + VALUE (*invoker)(const struct rb_call_info_struct *ci, const VALUE *argv); int argc; } rb_method_cfunc_t; -- cgit v1.2.3