* mono-cq.c (mono_cq_add_node): Add a store store fence
between the two stores as they can be observed OOO.
* mono-cq.c (mono_cq_create): Use precise roots for head
and tail.
MonoCQ *cq;
cq = g_new0 (MonoCQ, 1);
- MONO_GC_REGISTER_ROOT (cq->head);
- MONO_GC_REGISTER_ROOT (cq->tail);
+ MONO_GC_REGISTER_ROOT_SINGLE (cq->head);
+ MONO_GC_REGISTER_ROOT_SINGLE (cq->tail);
cq->head = mono_mlist_alloc ((MonoObject *) mono_cqitem_alloc ());
cq->tail = cq->head;
CQ_DEBUG ("Created %p", cq);
n = mono_mlist_alloc ((MonoObject *) mono_cqitem_alloc ());
prev_tail = cq->tail;
MONO_OBJECT_SETREF (prev_tail, next, n);
+
+ /* prev_tail->next must be visible before the new tail is */
+ STORE_STORE_FENCE;
+
cq->tail = n;
}