RFR: Combine store-val with satb-prebarrier
Roman Kennke
rkennke at redhat.com
Mon Jan 16 14:01:14 UTC 2017
This patch combines the storeval-(read-)barrier with the SATB pre-barrier.
The usual pattern for object-stores is this:
val = read_barrier_storeval(val);
if (marking) {
push_satb(pre_val);
}
store(addr, val);
however, we only need the storeval-barrier when updating references, which currently only happens during marking. And since we already check for marking, we can just as well combine the two:
if (marking) {
val = read_barrier_storeval(val);
push_satb(pre_val);
}
store(addr, val);
There's a caveat though: storing only (likely) to-space objects into
fields has the potential advantage to update references early and make
cache misses for read-barriers on such fields less likely. And it
possibly reduces work when actually updating references.
Some benchmarks in SPECjvm seem to benefit from this change (e.g.
serial, xml, derby) some are unaffected (e.g. scimark):
https://paste.fedoraproject.org/528249/14845638/
I made this optimization optional and disabled by default. (-
XX:+ShenandoahReduceStoreValBarriers turns it on).
I suspect the effect of this optimization will be more pronounced with
incremental-update (still working on this), because there we can also
fold-up the null-check and avoid the loading of the pre-value.
I needed to change the interface for GraphKit::pre_barrier() a little:
it now returns a possibly modified newval.
The Shenandoah implementation of the pre-barrier is based on the G1
version, with the inserted read-barrier in the if (marking) {.. }
branch. It also uses the G1 version as fallback, in case no newval is
passed (used for Reference.get() where we're not actually storing
anything).
http://cr.openjdk.java.net/~rkennke/reduce-storeval-barrier/webrev.00/
Ok to push?
Roman
More information about the shenandoah-dev
mailing list