[aarch64-port-dev ] [NEW BUG]Missing LoadStore barrier in interpreter?

Lun Liu lunliu93 at gmail.com
Wed Jan 30 20:36:58 UTC 2019


Hi aarch64-port devs,

I am new to the OpenJDK community so hope I am posting on the right mailing
list.

I noticed in the template interpreter only a StoreStore barrier is used
before a volatile write. According to JMM cookbook I think a LoadStore
barrier is also needed to prevent reordering between a normal read and a
volatile write. In the template interpreter it seems like LoadLoad |
LoadStore barriers are inserted after both normal read and volatile read so
it should be fine but I think this might cause a problem if the compiler
generates a normal read using dmb barriers and the interpreter is executing
the volatile write. Could this be a potential bug?

I am browsing aarch64-port/jdk8u code with the following changeset as the
lastest change
changeset:   9947:1d411780111d
tag:         tip
user:        fyang
date:        Mon Dec 24 13:42:31 2018 +0800
summary:     8209414: AArch64: method handle invocation does not respect
JVMTI interp_only mode

This could be fixed by a simple patch below
diff -r 1d411780111d src/cpu/aarch64/vm/templateTable_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateTable_aarch64.cpp      Mon Dec 24 13:42:31
2018 +0800
+++ b/src/cpu/aarch64/vm/templateTable_aarch64.cpp      Wed Jan 30 21:34:47
2019 +0100
@@ -2633,7 +2633,7 @@
   {
     Label notVolatile;
     __ tbz(r5, ConstantPoolCacheEntry::is_volatile_shift, notVolatile);
-    __ membar(MacroAssembler::StoreStore);
+    __ membar(MacroAssembler::StoreStore | LoadStore);
     __ bind(notVolatile);
   }

Thank you for any help.

Best,
-- 
Lun Liu
PhD Candidate
Computer Science Department
University of California, Los Angeles


More information about the aarch64-port-dev mailing list