[ruby-cvs:54656] normal:r47508 (trunk): compile: translate iseq in-place

normal at ruby-lang.org normal at ruby-lang.org
Wed Sep 10 15:14:09 JST 2014


normal	2014-09-10 15:14:07 +0900 (Wed, 10 Sep 2014)

  New Revision: 47508

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

  Log:
    compile: translate iseq in-place
    
    running "ruby -rpp -e 'pp GC.stat'", a reduction in
    malloc usage is shown:
    
    before:
    :malloc_increase=>118784,
    :oldmalloc_increase=>1178736,
    
    after:
    :malloc_increase=>99832,
    :oldmalloc_increase=>1031976,
    
    For "ruby -e exit", valgrind reports over 300K reduction in
    overall allocations (and unnecessary memory copies).
    
    before:
      total heap usage: 49,622 allocs, 20,492 frees, 8,697,493 bytes allocated
    after:
      total heap usage: 48,935 allocs, 19,805 frees, 8,373,773 bytes allocated
    
    (numbers from x86-64)
    
    v2 changes based on ko1 recommendations [ruby-core:64883]:
    - squashed in-place direct thread translation to avoid alloc+copy
    - renamed rb_iseq_untranslate_threaded_code to rb_iseq_original_iseq,
      cache new iseq->iseq_original field.
    
    * compile.c (rb_iseq_translate_threaded_code): modify in-place w/o copy
      (rb_vm_addr2insn): new function for debug
      (rb_iseq_original_iseq): ditto
      (iseq_set_sequence): assign iseq_encoded directly
      [Feature #10185]
    
    * vm_core (rb_iseq_t): move original ->iseq to bottom
    
    * iseq.c (iseq_free, iseq_free): adjust for new layout
      (rb_iseq_disasm): use original iseq for dump
      (iseq_data_to_ary): ditto
      (rb_iseq_line_trace_each): ditto
      (rb_iseq_build_for_ruby2cext): use iseq_encoded directly
    
    * vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/iseq.c
    trunk/iseq.h
    trunk/vm_core.h
    trunk/vm_dump.c


More information about the ruby-cvs mailing list