Release store in C2 putfield

Andrew Haley aph at redhat.com
Wed Sep 3 18:16:28 UTC 2014


On 09/03/2014 06:21 PM, Vladimir Kozlov wrote:
> Andrew,
> 
> Do you need unordered in Parse::array_store() too?

Yes.

> Another way of doing it is to define MemNode::release_if_reference() in .ad files in 'source %{' section.

Yes, that's what we've got now.  Thanks.

Andrew.


# HG changeset patch
# User Edward Nevill edward.nevill at linaro.org
# Date 1409307165 -3600
#      Fri Aug 29 11:12:45 2014 +0100
# Node ID fc245bc14fa3589074c78ceb0e25ecf36ee3e110
# Parent  32fae3443576ac6b4b5ac0770c0829ce6c08764e
Dont use a release store when storing an OOP in a non-volatile field.

diff -r 32fae3443576 -r fc245bc14fa3 src/share/vm/opto/memnode.hpp
--- a/src/share/vm/opto/memnode.hpp	Mon Sep 01 13:10:18 2014 -0400
+++ b/src/share/vm/opto/memnode.hpp	Fri Aug 29 11:12:45 2014 +0100
@@ -503,6 +503,12 @@
   // Conservatively release stores of object references in order to
   // ensure visibility of object initialization.
   static inline MemOrd release_if_reference(const BasicType t) {
+    // 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(return unordered);
+
     const MemOrd mo = (t == T_ARRAY ||
                        t == T_ADDRESS || // Might be the address of an object reference (`boxing').
                        t == T_OBJECT) ? release : unordered;
diff -r 32fae3443576 -r fc245bc14fa3 src/share/vm/opto/parse2.cpp
--- a/src/share/vm/opto/parse2.cpp	Mon Sep 01 13:10:18 2014 -0400
+++ b/src/share/vm/opto/parse2.cpp	Fri Aug 29 11:12:45 2014 +0100
@@ -1689,7 +1689,7 @@
     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, StoreNode::release_if_reference(T_OBJECT));
     break;
   }
   case Bytecodes::_lastore: {



More information about the hotspot-dev mailing list