[ruby-cvs:54710] normal:r47562 (trunk): proc.c (rb_proc_alloc): inline and move to vm.c

normal at ruby-lang.org normal at ruby-lang.org
Sat Sep 13 05:57:47 JST 2014


normal	2014-09-13 05:57:45 +0900 (Sat, 13 Sep 2014)

  New Revision: 47562

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47562

  Log:
    proc.c (rb_proc_alloc): inline and move to vm.c
    
    * proc.c (rb_proc_alloc): inline and move to vm.c
      (rb_proc_wrap): new wrapper function used by rb_proc_alloc
      (proc_dup): simplify alloc + copy + wrap operation
      [ruby-core:64994]
    
    * vm.c (rb_proc_alloc): new inline function
      (rb_vm_make_proc): call rb_proc_alloc
    
    * vm_core.h: remove rb_proc_alloc, add rb_proc_wrap
    
    * benchmark/bm_vm2_newlambda.rb: short test to show difference
    
    First we allocate and populate an rb_proc_t struct inline to avoid
    unnecessary zeroing of the large struct.  Inlining speeds up callers as
    this takes many parameters to ensure correctness.  We then call the new
    rb_proc_wrap function to create the object.
    
    rb_proc_wrap - wraps a rb_proc_t pointer as a Ruby object, but
    we only use it inside rb_proc_alloc.  We must call this before
    the compiler may clobber VALUE parameters passed to rb_proc_alloc.

  Added files:
    trunk/benchmark/bm_vm2_newlambda.rb
  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/vm.c
    trunk/vm_core.h


More information about the ruby-cvs mailing list