RFC (S): Purge ShenandoahVerifyWritesToFromSpace
Aleksey Shipilev
shade at redhat.com
Thu Apr 20 19:23:21 UTC 2017
Hi,
My attempts to salvage VerifyWrites were unsuccessful. The problematic part is
fwdptr stores, that are legal in from-space. I don't see a good way to accept
those writes only.
a) Intercepting SEGV in handler and figuring out it was legit is hard, but the
hardest part is calling mprotect from signal handler (seems like POSIX is
frowning upon this), and reestablishing mprotect on exit.
b) Wrapping fwdptr writes in memProtect{Off,On} is only easy to do with native
code, but not when our write barriers are spelled in IR. I shudder at the
thought to introduce runtime calls in C2 WB, for example.
c) Middle ground: memprotecting regions as we finish evacuating them runs into
the interesting trouble with x86. There, locked CAS always produces the store.
And we use that fwdptr CAS to resolve the conflict in concurrent copy. So, even
if GC finishes with region and memprotects it, the mutator would still blow up
on PROT_NONE. We can alleviate this by doing test before CAS, but that only
shortens the race window, and does not eliminate it completely. Not to mention
the issues for introducing another branch in WBs.
For the record, this is my last attempt:
http://cr.openjdk.java.net/~shade/shenandoah/purge-verifywrites/shenandoah-memprotect-write.patch
At this point, I believe VerifyWrites in unsalvageable, and should be purged:
http://cr.openjdk.java.net/~shade/shenandoah/purge-verifywrites/webrev/
Testing: hotspot_gc_shenandoah
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list