[aarch64-port-dev ] Don't use a release store when storing an OOP in a non-volatile field.
Andrew Haley
aph at redhat.com
Fri Aug 22 15:58:04 UTC 2014
HotSpot always uses a release tore when writing OOP fields, because:
// Non-volatile fields also need releasing stores if they hold an
// object reference, because the object reference might point to
// a freshly created object.
This isn't needed on AArch64 because we generate a memory barrier when
the object is created and there is an address dependency from a read
instruction to a program-order-later read or write instruction when
the value read by the first is used to compute the address used for
the second. See 4.1, Address Dependencies, in
http://www.cl.cam.ac.uk/~pes20/ppc-supplemental/test7.pdf for all the
gory details.
I suspect that every CPU on which HotSpot runs respects address
dependencies in the same way.
Andrew.
# HG changeset patch
# User aph
# Date 1408722585 14400
# Fri Aug 22 11:49:45 2014 -0400
# Node ID 6e5128f86ad8bf307f0d7cea6e3bfd203cab8262
# Parent 6a5c5cb9dde89ea50fefe4bf2e41c02d62a5beec
Don't use a release store when storing an OOP in a non-volatile field.
diff -r 6a5c5cb9dde8 -r 6e5128f86ad8 src/share/vm/opto/parse2.cpp
--- a/src/share/vm/opto/parse2.cpp Fri Aug 22 10:52:59 2014 -0400
+++ b/src/share/vm/opto/parse2.cpp Fri Aug 22 11:49:45 2014 -0400
@@ -1689,7 +1689,9 @@
a = pop(); // the array itself
const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->make_oopptr();
const TypeAryPtr* adr_type = TypeAryPtr::OOPS;
- Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT, MemNode::release);
+ Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT,
+ NOT_AARCH64(MemNode::release)
+ AARCH64_ONLY(MemNode::unordered));
break;
}
case Bytecodes::_lastore: {
diff -r 6a5c5cb9dde8 -r 6e5128f86ad8 src/share/vm/opto/parse3.cpp
--- a/src/share/vm/opto/parse3.cpp Fri Aug 22 10:52:59 2014 -0400
+++ b/src/share/vm/opto/parse3.cpp Fri Aug 22 11:49:45 2014 -0400
@@ -303,8 +303,12 @@
// Non-volatile fields also need releasing stores if they hold an
// object reference, because the object reference might point to
// a freshly created object.
- StoreNode::release_if_reference(bt);
-
+ NOT_AARCH64(StoreNode::release_if_reference(bt))
+ // AArch64 doesn't need a release store because if there is an
+ // address dependency between a read and a write, then those
+ // memory accesses are observed in program order by all observers
+ // within the shareability domain.
+ AARCH64_ONLY(MemNode::unordered);
// Store the value.
Node* store;
if (bt == T_OBJECT) {
More information about the aarch64-port-dev
mailing list