[ruby-cvs:69862] tenderlove:r62706 (trunk): Add direct marking on iseq operands

tenderlove at ruby-lang.org tenderlove at ruby-lang.org
Sat Mar 10 05:11:45 JST 2018


tenderlove	2018-03-10 05:11:45 +0900 (Sat, 10 Mar 2018)

  New Revision: 62706

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

  Log:
    Add direct marking on iseq operands
    
    Directly marking iseq operands allows us to eliminate the "mark array"
    stored on ISEQ objects, which will reduce the amount of memory ISEQ
    objects consume.  This patch changes the iseq mark function to:
    
    * Directly marks ISEQ operands
    * Iterate over and mark child ISEQs
    
    It also introduces two flags on the ISEQ object.  In order to mark
    instruction operands, we have to disassemble the instructions and find
    the instruction parameters and types.  Instructions may also be
    translated to jump addresses.  Instruction sequences may get marked by
    the GC *while* they're mid flight (being compiled).  The
    `ISEQ_TRANSLATED` flag is used to indicate whether or not the
    instructions have been translated to jump addresses so that when we
    decode the instructions we know whether or not we need to go from jump
    location back to original instruction or not.
    
    Not all ISEQ objects have any markable objects embedded in their
    instructions.  We can detect whether or not an ISEQ has markable objects
    in the instructions at compile time.  If the instructions contain
    markable objects, we set a flag `ISEQ_MARKABLE_ISEQ` on the ISEQ object.
    This means that during the mark phase, we can skip decompilation if the
    flag is *not* set.  In other words, we can avoid decompilation of we
    know in advance there is nothing to mark.
    
    `once` instructions have an operand that contains the result of a
    one-time compilation of a regex.  Before this patch, that operand was
    called an "inline cache", even though the struct was actually an "inline
    storage".  This patch changes the operand to be an "inline storage" so
    that we can differentiate between caches that need marking (the inline
    storage) and caches that don't need marking (inline cache).
    
    [ruby-core:84909]

  Modified files:
    trunk/compile.c
    trunk/insns.def
    trunk/iseq.c
    trunk/iseq.h
    trunk/tool/ruby_vm/models/typemap.rb
    trunk/vm_core.h
    trunk/vm_insnhelper.c


More information about the ruby-cvs mailing list