projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c35aa05
)
[sgen] Move & document write barrier.
author
Jon Purdy
<evincarofautumn@gmail.com>
Mon, 11 May 2015 22:25:24 +0000
(15:25 -0700)
committer
Jon Purdy
<evincarofautumn@gmail.com>
Thu, 3 Sep 2015 23:24:10 +0000
(16:24 -0700)
mono/sgen/sgen-gchandles.c
patch
|
blob
|
history
diff --git
a/mono/sgen/sgen-gchandles.c
b/mono/sgen/sgen-gchandles.c
index b18a65afa82ddb7c436bcc3b69553e71cce526dd..3fb721e39f9592366262ef468b1607d048d6d5b2 100644
(file)
--- a/
mono/sgen/sgen-gchandles.c
+++ b/
mono/sgen/sgen-gchandles.c
@@
-231,11
+231,14
@@
handle_data_grow (HandleData *handles, guint32 old_capacity)
entries = g_malloc0 (new_bucket_size);
if (handles->type == HANDLE_PINNED)
sgen_register_root ((char *)entries, new_bucket_size, SGEN_DESCRIPTOR_NULL, ROOT_TYPE_PINNED, MONO_ROOT_SOURCE_GC_HANDLE, "pinned gc handles");
entries = g_malloc0 (new_bucket_size);
if (handles->type == HANDLE_PINNED)
sgen_register_root ((char *)entries, new_bucket_size, SGEN_DESCRIPTOR_NULL, ROOT_TYPE_PINNED, MONO_ROOT_SOURCE_GC_HANDLE, "pinned gc handles");
+ /* The zeroing of the newly allocated bucket must be complete before storing
+ * the new bucket pointer.
+ */
+ mono_memory_write_barrier ();
if (InterlockedCompareExchangePointer ((volatile gpointer *)&handles->entries [new_bucket], entries, NULL) == NULL) {
if (InterlockedCompareExchange ((volatile gint32 *)&handles->capacity, new_capacity, old_capacity) != old_capacity)
g_assert_not_reached ();
handles->slot_hint = old_capacity;
if (InterlockedCompareExchangePointer ((volatile gpointer *)&handles->entries [new_bucket], entries, NULL) == NULL) {
if (InterlockedCompareExchange ((volatile gint32 *)&handles->capacity, new_capacity, old_capacity) != old_capacity)
g_assert_not_reached ();
handles->slot_hint = old_capacity;
- mono_memory_write_barrier ();
return;
}
/* Someone beat us to the allocation. */
return;
}
/* Someone beat us to the allocation. */