RFR (M): (x86) Fix up and refactor store checks

Aleksey Shipilev shade at redhat.com
Tue Apr 25 18:31:24 UTC 2017


Hi,

With Verify{Reads|Writes} purged, the only way for us to verify store invariants
is compiler-assisted checks. Which means we would like make them work better
than they are now.

This is the update:
  http://cr.openjdk.java.net/~shade/shenandoah/store-check-refactor/webrev.01/

Brief tour of changes:

 a) Split store_check into store_addr_check and store_val_check. This simplifies
checking logic. For example, there was a bug where we checked the store address,
and if it was outside of cset, we just jumped to "done", without checking the
value we store!

 b) in_heap check is merged with in_cset check. It goes better in the generated
code, because now we can test if the "region index" within the cset bitmap, thus
implicitly testing if reference is in heap. Saves a register.

 c) Purging "line" and "file" arguments out. This keeps implementation cleaner,
and this information is useless anyway, since most of the checks are coming from
.ad through the series of transformations.

 d) Using custom SEGV instead of calling stop(...). This saves lots of register
saving before calling the debug64 leaf method. And that register data is
available anyway when we crash on SEGV. Saves a considerable number of
instructions in the stream.

 e) Accepting that registers would get destroyed helps to avoid defensive
copies. We have all values on stack and restore from there anyway!

 f) Carefully selecting the temp register avoids clashes.

 g) Shorter jumps make barrier code denser.

All in all, this reduces the store check from 253 bytes to 60 bytes. This is a
huge improvement, because store checks are done for *each* heap store.

This only takes care of x86 side of things. Let us mine out x86 side first,
before considering porting this to AArch64.

Testing: hotspot_gc_shenandoah, jcstress -m quick

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list