CAS code misses check for null

Andrew Haley aph at redhat.com
Tue Jun 14 09:15:25 UTC 2016


On 14/06/16 09:39, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/cas-null/webrev/
> 
> Applying the read barrier to the expected value or the value retrieved
> from memory in the CAS can cause a crash if one of those is null.

Wow, however did we miss that?

I don't understand this change:

-  bind(fail);
+  bind(check);
+
+  ands(zr, tmp2, expected);
+  br(EQ, failure);

What does this ANDS do?  I would have thought something more like

    tbz(expected, failure);
    tbz(tmp2, failure);

would be correct.  Otherwise you're just ANDing bits of an address
together.

Also,

+
   if (!acquire) dmb(LD); // Required: updates to the brooks pointer
-                         // could be missed otherwise
+  // could be missed otherwise

this change of indentation is wrong.

Andrew.



More information about the shenandoah-dev mailing list