Seeing error in one test on ARM: org.openjdk.jcstress.tests.volatiles.ReadTwiceOverVolatileReadTest
Aleksey Shipilev
shade at redhat.com
Thu Feb 23 13:46:55 UTC 2017
On 02/23/2017 02:42 PM, Andrew Haley wrote:
> On 23/02/17 10:19, Aleksey Shipilev wrote:
>> What I find alarming though, is that generated code has reads in actor2() in
>> order.
>
> What exactly does this comment mean?
It means that in:
int x;
volatile int y;
@Actor
public void actor1() {
x = 1;
y = 1;
}
@Actor
public void actor2(IntResult3 r) {
r.r1 = x;
r.r2 = y;
r.r3 = x;
}
actor() is generated like:
--- C2 ---:
ldr w0, [x1,#12] ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
str w0, [x2,#12] ;*putfield r1 {reexecute=0 rethrow=0 return_oop=0}
ldr w0, [x1,#16]
dmb ishld ;*getfield y {reexecute=0 rethrow=0 return_oop=0}
str w0, [x2,#16] ;*putfield r2 {reexecute=0 rethrow=0 return_oop=0}
ldr w0, [x1,#12] ;*getfield x {reexecute=0 rethrow=0 return_oop=0}
str w0, [x2,#20] ;*putfield r3 {reexecute=0 rethrow=0 return_oop=0}
In this code, the reads of $x into r1 and r3 are in "program order". But this is
the read of the same variable, and they should be _coherent_ on ARM. The result
(1, 0, 0) is impossible then. So either this is a hardware bug, or there is some
other version of generated code where reads of $x have swapped.
Thanks,
-Aleksey
More information about the jcstress-dev
mailing list