Ensure proper ordering of hazard pointer reads.
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 11 Oct 2011 12:21:55 +0000 (09:21 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Tue, 11 Oct 2011 12:40:36 +0000 (09:40 -0300)
* hazard-pointer.c (is_pointer_hazardous): Reads between the hazard
pointers of a given thread must be ordered since code such as the
liked-list-set that does centipede traversal needs it to be correct.

mono/utils/hazard-pointer.c

index 053bee32c6e64b85391aac4825529232b0bfacf4..cc86ce7e098ba57c4d5a4fb5afa6866a295aa2a3 100644 (file)
@@ -9,6 +9,7 @@
 #include <mono/metadata/class-internals.h>
 #include <mono/utils/hazard-pointer.h>
 #include <mono/utils/mono-membar.h>
+#include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/monobitset.h>
 #include <mono/utils/mono-threads.h>
@@ -143,6 +144,7 @@ is_pointer_hazardous (gpointer p)
                for (j = 0; j < HAZARD_POINTER_COUNT; ++j) {
                        if (hazard_table [i].hazard_pointers [j] == p)
                                return TRUE;
+                       LOAD_LOAD_FENCE;
                }
        }