<p>StoreLoad is only needed to prevent a load moving ahead of a prior write in the *writing* thread - from Jon's description he only needs to ensure that the gc thread reads a consistent(fully initialized) object from the other thread (i.e. object was fully initialized before it's written to the queue rather than being written to the queue but having initializing writes happen after that).</p>
<div class="gmail_quote">On Dec 9, 2011 11:43 PM, "Igor Veresov" <<a href="mailto:igor.veresov@oracle.com">igor.veresov@oracle.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Jon,<br>
<br>
Since you are describing a dependency between stores and subsequent loads from other threads, shouldn't it be a "storeload" barrier?<br>
<br>
igor<br>
<br>
<br>
On Friday, December 9, 2011 at 1:19 PM, Jon Masamitsu wrote:<br>
<br>
><br>
><br>
> On 12/9/2011 1:01 PM, Vitaly Davidovich wrote:<br>
> > Ok sounds like storestore is sufficient given your explanation - you don't<br>
> > care whether the task is immediately visible to gc threads after it's<br>
> > enqueued, you just want to make sure that once it is visible (might be<br>
> > delayed due to store bufferring) that all fields are consistent.<br>
><br>
><br>
> Yes, that's correct.<br>
><br>
> > I'm obviously not on the hotspot dev team (just a curious bystander :)) but<br>
> > perhaps you can change the code comment to indicate that you want ordered<br>
> > writes but not necessarily immediately global visibility.<br>
><br>
><br>
><br>
> Will do. Thanks again.<br>
><br>
> Jon<br>
> > Thanks for the explanation,<br>
> ><br>
> > Vitaly<br>
> > On Dec 9, 2011 3:49 PM, "Jon Masamitsu"<<a href="mailto:jon.masamitsu@oracle.com">jon.masamitsu@oracle.com</a> (mailto:<a href="mailto:jon.masamitsu@oracle.com">jon.masamitsu@oracle.com</a>)> wrote:<br>
> ><br>
> > > Vitaly,<br>
> > ><br>
> > > This is what happens.<br>
> > ><br>
> > > 1) create the barrier task<br>
> > > 2) enqueue the barrier task to a list of tasks<br>
> > > 3) make the tasks visible to the GC workers by added them to<br>
> > > queue from which workers take tasks<br>
> > ><br>
> > > At 3) a GC worker can take and execute the barrier task.<br>
> > > I want all the fields in the barrier task to be in main memory<br>
> > > and thus visible to the GC worker task when it starts to<br>
> > > execute the barrier task. So by the time 3) happens<br>
> > > (tasks are visible in the queue for the GC workers to<br>
> > > take) the stores at 1) to be visible so that when the GC<br>
> > > worker reads the barrier task, it is getting all the right<br>
> > > values.<br>
> > ><br>
> > > I think that's what the storestore does for me. Do I<br>
> > > need something stronger? And thank you for thinking<br>
> > > about this for me.<br>
> > ><br>
> > > Jon<br>
> > ><br>
> > > On 12/9/2011 9:48 AM, Vitaly Davidovich wrote:<br>
> > ><br>
> > > > Hi Jon,<br>
> > > ><br>
> > > > Are you sure your comment for the OrderAccess::storestore() matches this<br>
> > > > barrier? Your comment mentions that you want global visibility but does<br>
> > > > this need immediate visibility or you just want order for when it does<br>
> > > > become visible? StoreStore is just the latter, but maybe that's what you<br>
> > > > meant.<br>
> > > ><br>
> > > > Regards,<br>
> > > ><br>
> > > > Vitaly<br>
> > > > On Dec 9, 2011 12:15 PM, "Jon Masamitsu"<jon.masamitsu@**<a href="http://oracle.com" target="_blank">oracle.com</a><<a href="mailto:jon.masamitsu@oracle.com">jon.masamitsu@oracle.com</a> (mailto:<a href="mailto:jon.masamitsu@oracle.com">jon.masamitsu@oracle.com</a>)>><br>
> > > > wrote:<br>
> > > ><br>
> > > > 7119584: UseParallelGC barrier task can be overwritten.<br>
> > > > > Just a few changed lines. The comments around the changes<br>
> > > > > give an explanation in context so are a better explanation than<br>
> > > > > I can summarize here.<br>
> > > > ><br>
> > > > > <a href="http://cr.openjdk.java.net/~****jmasa/7119584/webrev.00/" target="_blank">http://cr.openjdk.java.net/~****jmasa/7119584/webrev.00/</a><<a href="http://cr.openjdk.java.net/~**jmasa/7119584/webrev.00/" target="_blank">http://cr.openjdk.java.net/~**jmasa/7119584/webrev.00/</a>><br>
> > > > > <http:**//<a href="http://cr.openjdk.java.net/~jmasa/**7119584/webrev.00/" target="_blank">cr.openjdk.java.net/~jmasa/**7119584/webrev.00/</a><<a href="http://cr.openjdk.java.net/~jmasa/7119584/webrev.00/" target="_blank">http://cr.openjdk.java.net/~jmasa/7119584/webrev.00/</a>><br>
> > > > > Thanks.<br>
> > > ><br>
> > ><br>
> ><br>
><br>
<br>
<br>
<br>
</blockquote></div>