[ruby-cvs:66153] ko1:r58979 (trunk): rename absolute_path to realpath internally and introduce pathobj.

ko1 at ruby-lang.org ko1 at ruby-lang.org
Thu Jun 1 09:05:34 JST 2017


ko1	2017-06-01 09:05:33 +0900 (Thu, 01 Jun 2017)

  New Revision: 58979

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

  Log:
    rename absolute_path to realpath internally and introduce pathobj.
    
    * vm_core.h: rename absolute_path to realpath because it is expected name.
      external APIs (#absolute_path methods) are remained.
    
    * vm_core.h: remove rb_iseq_location_struct::path and
      rb_iseq_location_struct::absolute_path and introduce pathobj.
      if given path equals to given absolute_path (and most of case
      it is true), pathobj is simply given path String. If it is not same,
      pathobj is Array and pathobj[0] is path and pathobj[1] is realpath.
    
      This size optimization reduce 8 bytes and
      sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes
      on 64bit CPU.
    
      To support this change, the following functions are introduced:
        * pathobj_path() (defined in vm_core.h)
        * pathobj_realpath() (ditto)
        * rb_iseq_path() (decl. in vm_core.h)
        * rb_iseq_realpath() (ditto)
        * rb_iseq_pathobj_new() (ditto)
        * rb_iseq_pathobj_set() (ditto)
    
    * vm_core.h (rb_binding_t): use pathobj instead of path. If binding
      is given at eval methods, realpath (absolute_path) was caller's
      realpath. However, they should use binding's realpath.

  Modified files:
    trunk/compile.c
    trunk/debug_counter.h
    trunk/gc.c
    trunk/iseq.c
    trunk/iseq.h
    trunk/proc.c
    trunk/vm.c
    trunk/vm_backtrace.c
    trunk/vm_core.h
    trunk/vm_dump.c
    trunk/vm_eval.c
    trunk/vm_method.c
    trunk/vm_trace.c


More information about the ruby-cvs mailing list