United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6888847 TaskQueue needs release_store() for correctness on RMO machines
JDK-6888847 : TaskQueue needs release_store() for correctness on RMO machines

Details
Type:
Bug
Submit Date:
2009-10-06
Status:
Resolved
Updated Date:
2013-01-26
Project Name:
JDK
Resolved Date:
2009-11-11
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs17
Fixed Versions:
hs17 (b04)

Related Reports
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
Even though the task queues work correctly on TSO machines, it turns out that they are incorrect when ran on non-TSO machines, as they are missing two release_stores.

                                    

Comments
SUGGESTED FIX

@@ -205,11 +205,11 @@
 bool GenericTaskQueue<E>::push_slow(E t, uint dirty_n_elems) {
   if (dirty_n_elems == N - 1) {
     // Actually means 0, so do the push.
     uint localBot = _bottom;
     _elems[localBot] = t;
-    _bottom = increment_index(localBot);
+    OrderAccess::release_store(&_bottom, increment_index(localBot));
     return true;
   }
   return false;
 }
 

@@ -483,11 +483,11 @@
   idx_t top = _age.top();
   uint dirty_n_elems = dirty_size(localBot, top);
   assert((dirty_n_elems >= 0) && (dirty_n_elems < N), "n_elems out of range.");
   if (dirty_n_elems < max_elems()) {
     _elems[localBot] = t;
-    _bottom = increment_index(localBot);
+    OrderAccess::release_store(&_bottom, increment_index(localBot));
     return true;
   } else {
     return push_slow(t, dirty_n_elems);
   }
 #endif
                                     
2009-10-06
EVALUATION

Add release_stores where appropriate.
                                     
2009-10-06
SUGGESTED FIX

Thanks to Bob Vandette for the fix.
                                     
2009-10-06
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/2c03ce058f55
                                     
2009-10-08



Hardware and Software, Engineered to Work Together