* vm_core.h, vm_insnhelper.c, vm_eval.c (OPT_CALL_CFUNC_WITHOUT_FRAME):

add a new otpimization and its macro `OPT_CALL_CFUNC_WITHOUT_FRAME'.
  This optimization makes all cfunc method calls `frameless', which
  is fster than ordinal cfunc method call.
  If `frame' is needed (for example, it calls another method with
  `rb_funcall()'), then build a frame. In other words, this
  optimization delays frame building.
  However, to delay the frame building, we need additional overheads:
  (1) Store the last call information.
  (2) Check the delayed frame buidling before the frame is needed.
  (3) Overhead to build a delayed frame.
  rb_thread_t::passed_ci is storage of delayed cfunc call information.
  (1) is lightweight because it is only 1 assignment to `passed_ci'.
  To achieve (2), we modify GET_THREAD() to check `passed_ci' every
  time. It causes 10% overhead on my envrionment.
  This optimization only works for cfunc methods which do not need
  their `frame'.
  After evaluation on my environment, this optimization does not
  effective every time. Because of this evaluation results, this
  optimization is disabled at default.
* vm_insnhelper.c, vm.c: add VM_PROFILE* macros to measure behaviour
  of VM internals. I will extend this feature.
* vm_method.c, method.h: change parameters of the `invoker' function.
  Receive `func' pointer as the first parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2012-10-23 04:22:31 +00:00
parent 3c73f44c7f
commit 9eba45a72a
7 changed files with 278 additions and 84 deletions

View file

@ -49,7 +49,7 @@ 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);
VALUE (*invoker)(VALUE (*func)(ANYARGS), const struct rb_call_info_struct *ci, const VALUE *argv);
int argc;
} rb_method_cfunc_t;