[ruby-cvs:67578] ko1:r60397 (trunk): Lazy Proc allocation for block parameters

ko1 at ruby-lang.org ko1 at ruby-lang.org
Tue Oct 24 20:13:49 JST 2017


ko1	2017-10-24 20:13:49 +0900 (Tue, 24 Oct 2017)

  New Revision: 60397

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

  Log:
    Lazy Proc allocation for block parameters
    [Feature #14045]
    
    * insns.def (getblockparam, setblockparam): add special access
      instructions for block parameters.
      getblockparam checks VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM and
      if it is not set this instruction creates a Proc object from
      a given blcok and set VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM.
      setblockparam is similar to setlocal, but set
      VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM.
    
    * compile.c: use get/setblockparm instead get/setlocal instructions.
      Note that they are used for method local block parameters (def m(&b)),
      not for block local method parameters (iter{|&b|).
    
    * proc.c (get_local_variable_ptr): creates Proc object for
      Binding#local_variable_get/set.
    
    * safe.c (safe_setter): we need to create Proc objects for postponed
      block parameters when $SAFE is changed.
    
    * vm_args.c (args_setup_block_parameter): used only for block local blcok
      parameters.
    
    * vm_args.c (vm_caller_setup_arg_block): if called with
      VM_CALL_ARGS_BLOCKARG_BLOCKPARAM flag then passed block values should be
      a block handler.
    
    * test/ruby/test_optimization.rb: add tests.
    
    * benchmark/bm_vm1_blockparam*: added.

  Added files:
    trunk/benchmark/bm_vm1_blockparam.rb
    trunk/benchmark/bm_vm1_blockparam_call.rb
    trunk/benchmark/bm_vm1_blockparam_pass.rb
    trunk/benchmark/bm_vm1_blockparam_yield.rb
  Modified files:
    trunk/compile.c
    trunk/insns.def
    trunk/proc.c
    trunk/safe.c
    trunk/test/ruby/test_optimization.rb
    trunk/vm_args.c
    trunk/vm_core.h
    trunk/vm_insnhelper.c


More information about the ruby-cvs mailing list