C2 compare and swap fixes
Roland Westrelin
rwestrel at redhat.com
Mon Jun 6 08:01:54 UTC 2016
Hi Roman,
Thanks for taking a look a this.
> Looks mostly good to me.
>
> I believe we don't have to match WeakCompareAndSwap. As far as I
> understand it, Weak-CAS can fail for unknown reasons. In our case, it
> should be ok to fail when comparing from- and to-space objects. I am
> not 100% sure about it though. Would be good to have a testcase or
> consult somebody who knows for sure.
I talked to Aleksey Shipilev briefly about this: the expectation is that
if you retry a weakCAS enough times it will eventually succeed.
http://mail.openjdk.java.net/pipermail/jmm-dev/2016-April/000239.html
has an example use case, that re-attempts a weakCAS until it succeeds.
What follows is my own interpretation: in case the value in memory is a
from space reference and the expected value passed to weakCAS is a to
space value, then the weakCAS would fail as long as the value in memory
is not updated to the to space value which as I understand, could cause
a thread to be stuck in a loop with a weakCAS until the GC threads
finally update the reference and could be a long time. So I don't think
we can simply let the weakCAS fail.
> In library_call.cpp, you can remove a couple more changes that I made.
> I added the need_mem and result stuff IIRC. Best to diff that method
> with upstream jdk9 and restore the original state.
I will take a look at that.
Roland/
More information about the shenandoah-dev
mailing list