Project

General

Profile

« Previous | Next » 

Revision c330037c

Added by Ruby (Elena Mangano) almost 2 years ago

cc->cme should not be marked.

cc is callcache.

cc->klass (klass) should not be marked because if the klass is
free'ed, the cc->klass will be cleared by vm_cc_invalidate().

cc->cme (cme) should not be marked because if cc is invalidated
when cme is free'ed.

  • klass marks cme if klass uses cme.
  • caller classe's ccs->cme marks cc->cme.
  • if cc is invalidated (klass doesn't refer the cc),
    cc is invalidated by vm_cc_invalidate() and cc->cme is
    not be accessed.
  • On the multi-Ractors, cme will be collected with global GC
    so that it is safe if GC is not interleaving while accessing
    cc and cme.

fix [Bug #19436]

10_000.times{|i|
  # p i if (i%1_000) == 0

  str = "x" * 1_000_000
  def str.foo = nil
  eval "def call#{i}(s) = s.foo"
  send "call#{i}", str
}

Without this patch:

real    1m5.639s
user    0m6.637s
sys     0m58.292s

and with this patch:

real    0m2.045s
user    0m1.627s
sys     0m0.164s