8195148: Collapse G1SATBCardTableModRefBS and G1SATBCardTableLoggingModRefBS into a single G1BarrierSet

Kim Barrett kim.barrett at oracle.com
Fri Mar 2 02:15:21 UTC 2018

> On Feb 26, 2018, at 8:38 AM, Erik Österlund <erik.osterlund at oracle.com> wrote:
> Hi,
> G1 has two barrier sets: an abstract G1SATBCardTableModRefBS barrier set that is incomplete and you can't use, and a concrete G1SATBCardTableLoggingModRefBS barrier set is what is the one actually used all over the place. The inheritance makes this code more difficult to understand than it needs to be.
> There should really not be an abstract G1 barrier set that is not used - it serves no purpose. There should be a single G1BarrierSet instead reflecting the actual G1 barriers used.
> Webrev:
> http://cr.openjdk.java.net/~eosterlund/8195148/webrev.00/
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8195148
> Thanks,
> /Erik

Mostly looks good.  One minor formatting nit, and one significant not so sure about this.

35 G1BarrierSet::G1BarrierSet(
36   G1CardTable* card_table) :
37   CardTableModRefBS(card_table, BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
38   _dcqs(JavaThread::dirty_card_queue_set())
39 { }

Move the argument to the same line as the constructor name, so it's
easier to tell what are arguments and what are initializers.

32 inline void G1BarrierSet::write_ref_field_pre(T* field) {

The change here doesn't seem to have anything to do with the renaming.
Rather, it looks like a separate bug fix?

The old code deferred the decode until after the null check, with the
decoding benefitting from having already done the null check.  At
first glance, the new code seems like it might not perform as well.

I do see why adding volatile is needed here though.


More information about the hotspot-dev mailing list