[aarch64-port-dev ] jcstress varhandles.DekkerTest fails on aarch64
Andrew Dinn
adinn at redhat.com
Fri Mar 2 11:24:23 UTC 2018
On 02/03/18 11:06, Zhongwei Yao wrote:
> I find this failure on aarch64 and but have not found the root cause
> yet. Because it may have an impact on nearby jdk10 release, I raised a
> bug first: https://bugs.openjdk.java.net/browse/JDK-8198950
>
> And my current finding is:
> - this only fails with c2, c1 and interpreter are OK.
> - the actor1 function in
> https://bugs.openjdk.java.net/secure/attachment/75427/DekkerVarTest.java
> c2 generated code is different under the good build (jdk10-b20) and
> bad build (master):
Hmm, thanks very much for finding this.
> good:
> 040 + add R10, R2, #12 # ptr
> 044 stlrw R12, [R10] # int ! Field: volatile DekkerVarTest$TestData.a
> 048 + membar_volatile (elided)
> 048
> 048
> 048 + add R10, R2, #16 # ptr
> 04c ldarw R0, [R10] # int ! Field: volatile DekkerVarTest$TestData.b
> 050 + membar_acquire (elided) //my comment: it generates "ldar" finally.
> 050
> 050 # pop frame 48
> bad:
> 038 B2: # N57 <- B1 Freq: 0.999999
> 038 + membar_release (elided)
> 038 + mov R12, #1 # int
> 03c
> 03c + add R10, R2, #12 # ptr
> 040 stlrw R12, [R10] # int ! Field: volatile DekkerVarTest$TestData.a
> 044 + membar_volatile (elided)
> 044
> 044
> 044 + ldrw R0, [R2, #16] # int ! Field: volatile DekkerVarTest$TestData.b
> 048 + membar_acquire //my comment: it generates "dmb ishld" finally.
> 04c
> 04c + # pop frame 48
Well, it makes sense that you are seeing Dekker failures in this second
case. The problem is that the volatile write has been transformed to
stlr but the volatile read has been translated to an ldr; dmb ishld
combination. The stlr transform is only valid if you also guarantee to
do the ldar transformation. If you do the stlr transformation and omit
the ldar transformation then the ldr needs a dmb before and after.
So, something appears to have changed in the C2 compiler that is
allowing the stlr transformation to be applied but inhibiting
application of the ldar transformation.
I'll take a look to see if I can find what is going on.
regards,
Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
More information about the aarch64-port-dev
mailing list