Mikhail, the gc_heap_slot_write_ref  is an old GC interface in ORP.
The original idea for this interface is, any Java heap slot reference
store should go through this GC function, including VM and Java
application. So this function does the real reference store, the
original store in JITted code will not be emitted. Hence the OPT write
barrier has no problem.

The problem with this interface is, it has no clear definition about
whether a write barrier is needed or not. That's why I suggested to
use a new interface gc_heap_slot_write_barrier for the helper inlining
work. The code for it is the same as gc_heap_slot_write_ref for
generational GC (without the check for needing barrier or not). Since
the WB inlined helper is only invoked when generational GC is run, the
check is redundant completely.

I am not sure if I make it clear.

Thanks,
xiaofeng

On 12/11/06, Mikhail Fursov <[EMAIL PROTECTED]> wrote:
Xiao-Feng,
I'm slightly confused about current WB support in Jitrino.OPT, so I need an
advice.

The problem: I think that write barriers in Jitrino OPT do not work.

Example (see for lines marked with =>):


HIR with WB disabled:

  I1:defarg.ths -) t1:cls:java/net/URLClassLoader$4
  I2:tauisnonnull      t1 -) t2:tau
  I3:tauhastype      t1,cls:java/net/URLClassLoader$4 -) t3:tau
  I4:defarg -) t4:cls:java/net/URLClassLoader
  I5:tauhastype      t4,cls:java/net/URLClassLoader -) t5:tau
  I6:defarg -) t6:cls:java/lang/String
  I7:tauhastype      t6,cls:java/lang/String -) t7:tau
  I8:ldflda    [t1.java/net/URLClassLoader$4::this$0] -)
t8:ref:cls:java/net/URLClassLoader
=>  I9:stind.unc:o   t4 ((t2,t3,t5)) -) [t8]
  I10:ldflda    [t1.java/net/URLClassLoader$4::val$clsName] -)
t9:ref:cls:java/lang/String
=>  I11:stind.unc:str t6 ((t2,t3,t7)) -) [t9]
  I12:tauunsafe() -) t10:tau
  I13:call      java/lang/Object::_init_(t1) ((t2,t10)) -)


The same HIR with WB enabled:

  Successors: L5 UNWIND
  I1:defarg.ths -) t1:cls:java/net/URLClassLoader$4
  I2:tauisnonnull      t1 -) t2:tau
  I3:tauhastype      t1,cls:java/net/URLClassLoader$4 -) t3:tau
  I4:defarg -) t4:cls:java/net/URLClassLoader
  I5:tauhastype      t4,cls:java/net/URLClassLoader -) t5:tau
  I6:defarg -) t6:cls:java/lang/String
  I7:tauhastype      t6,cls:java/lang/String -) t7:tau
  I8:ldflda    [t1.java/net/URLClassLoader$4::this$0] -)
t8:ref:cls:java/net/URLClassLoader
=>  I9:stref.wb.unc   t4 ((t2,t3,t5)) -) [t8 t1]
  I10:ldflda    [t1.java/net/URLClassLoader$4::val$clsName] -)
t9:ref:cls:java/lang/String
=>  I11:stref.wb.unc   t6 ((t2,t3,t7)) -) [t9 t1]
  I12:tauunsafe() -) t10:tau
  I13:call      java/lang/Object::_init_(t1) ((t2,t10)) -)



The LIR with WB disabled

    I1: t4:ref:cls:java/net/URLClassLoader (ID:s5(EFLGS):uint32) =ADD
t0:cls:java/net/URLClassLoader$4,t3(0:fo:java/net/URLClassLoader$4.this$0):intptr

=>    I2: (AD:t6[t4]:object) =CopyPseudoInst/MOV
(AU:t1:cls:java/net/URLClassLoader)
    I3: t8:ref:cls:java/lang/String (ID:s5(EFLGS):uint32) =ADD
t0:cls:java/net/URLClassLoader$4,t7(0:fo:java/net/URLClassLoader$4.val$clsName):intptr

=>    I4: (AD:t9[t8]:string) =CopyPseudoInst/MOV
(AU:t2:cls:java/lang/String)




The same LIR with WB enabled

    I1: t4:ref:cls:java/net/URLClassLoader (ID:s5(EFLGS):uint32) =ADD
t0:cls:java/net/URLClassLoader$4,t3(0:fo:java/net/URLClassLoader$4.this$0):intptr

=>    I2: CALL t6(0:h:WriteBarrier):ptr:intptr
(AU:t0:cls:java/net/URLClassLoader$4,t4:ref:cls:java/net/URLClassLoader,t1:cls:java/net/URLClassLoader)

    I3: t8:ref:cls:java/lang/String (ID:s5(EFLGS):uint32) =ADD
t0:cls:java/net/URLClassLoader$4,t7(0:fo:java/net/URLClassLoader$4.val$clsName):intptr

=>    I4: CALL t9(0:h:WriteBarrier):ptr:intptr
(AU:t0:cls:java/net/URLClassLoader$4,t8:ref:cls:java/lang/String,t2:cls:java/lang/String)



The question is what is in the CALL? I see only the method:
gc_heap_slot_write_ref and this method does not save anything into fields.
Does it mean that WB support in Jitrino.OPT is incomplete today?

--
Mikhail Fursov


Reply via email to