[aarch64-port-dev ] Add some memory barriers for object creation and runtime calls

Andrew Haley aph at redhat.com
Wed Nov 5 14:07:30 UTC 2014


We are missing some memory barriers for object creation (in the
interpreter) and calls to the VM (also in the intepreter).

Fixed thusly.

Andrew.


# HG changeset patch
# User aph
# Date 1415091875 18000
#      Tue Nov 04 04:04:35 2014 -0500
# Node ID 8fdbd65711c6e2404fce03e66b7abfca5d723f3d
# Parent  a6df78e590bb97446250ac5466f5d59a86161c43
Add some memory barriers for object creation and runtime calls.

diff -r a6df78e590bb -r 8fdbd65711c6 src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
--- a/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Wed Sep 10 10:42:58 2014 -0400
+++ b/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Tue Nov 04 04:04:35 2014 -0500
@@ -2816,6 +2816,7 @@
   __ reset_last_Java_frame(false, true);

   __ maybe_isb();
+  __ membar(Assembler::LoadLoad | Assembler::LoadStore);

   __ ldr(rscratch1, Address(rthread, Thread::pending_exception_offset()));
   __ cbz(rscratch1, noException);
diff -r a6df78e590bb -r 8fdbd65711c6 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Wed Sep 10 10:42:58 2014 -0400
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp	Tue Nov 04 04:04:35 2014 -0500
@@ -312,6 +312,7 @@
   address entry = __ pc();
   __ push(state);
   __ call_VM(noreg, runtime_entry);
+  __ membar(Assembler::AnyAny);
   __ dispatch_via(vtos, Interpreter::_normal_table.table_for(vtos));
   return entry;
 }
diff -r a6df78e590bb -r 8fdbd65711c6 src/cpu/aarch64/vm/templateTable_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Wed Sep 10 10:42:58 2014 -0400
+++ b/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Tue Nov 04 04:04:35 2014 -0500
@@ -3339,6 +3339,8 @@

   // continue
   __ bind(done);
+  // Must prevent reordering of stores for object initialization with stores that publish the new object.
+  __ membar(Assembler::StoreStore);
 }

 void TemplateTable::newarray() {
@@ -3347,6 +3349,8 @@
   __ mov(c_rarg2, r0);
   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::newarray),
           c_rarg1, c_rarg2);
+  // Must prevent reordering of stores for object initialization with stores that publish the new object.
+  __ membar(Assembler::StoreStore);
 }

 void TemplateTable::anewarray() {
@@ -3356,6 +3360,8 @@
   __ mov(c_rarg3, r0);
   call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::anewarray),
           c_rarg1, c_rarg2, c_rarg3);
+  // Must prevent reordering of stores for object initialization with stores that publish the new object.
+  __ membar(Assembler::StoreStore);
 }

 void TemplateTable::arraylength() {


More information about the aarch64-port-dev mailing list