Does G1's C1 barrier implementation always call the runtime write barrier function?
per.liden at oracle.com
Thu Mar 21 08:03:26 UTC 2019
On 3/20/19 4:40 PM, William Kemper wrote:
> I've been comparing the JIT assembly emitted by C1 and C2 and have come
> to believe that the code emitted by C1 always calls the runtime stub for
> the write barrier. Is there a reason for this? It seems the
> interpreter's assembler and C2 both emit assembly instructions for the
> write barrier, but C1 doesn't? have I missed something? I'm looking at
> OpenJDK 11.0.2.
It doesn't always call a stub, it does some basic filtering before that
(see G1BarrierSetC1::post_barrier() and G1BarrierSetC1::pre_barrier()).
Also note that C1 has a multi-level stub setup here, one call-site stub
which calls a global stub
which in turn might call into the VM. Each layer does some level of work
and/or filtering. You typically only call into the VM if the STAB/DCQ
buffer is full.
More information about the hotspot-gc-dev