diff options
-rw-r--r-- | mono/metadata/sgen-gc.c | 8 | ||||
-rw-r--r-- | mono/metadata/sgen-gc.h | 2 | ||||
-rw-r--r-- | mono/metadata/sgen-los.c | 4 | ||||
-rw-r--r-- | mono/metadata/sgen-marksweep.c | 10 |
4 files changed, 16 insertions, 8 deletions
diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c index 14889864a37..b6f98ff4b69 100644 --- a/mono/metadata/sgen-gc.c +++ b/mono/metadata/sgen-gc.c @@ -577,18 +577,18 @@ sgen_workers_get_job_gray_queue (WorkerData *worker_data) static LOCK_DECLARE (workers_distribute_gray_queue_mutex); -void +gboolean sgen_remember_major_object_for_concurrent_mark (char *obj) { gboolean need_lock = current_collection_generation != GENERATION_NURSERY; if (!major_collector.is_concurrent) - return; + return FALSE; g_assert (current_collection_generation == GENERATION_NURSERY || current_collection_generation == -1); if (!concurrent_collection_in_progress) - return; + return FALSE; if (need_lock) mono_mutex_lock (&workers_distribute_gray_queue_mutex); @@ -597,6 +597,8 @@ sgen_remember_major_object_for_concurrent_mark (char *obj) if (need_lock) mono_mutex_unlock (&workers_distribute_gray_queue_mutex); + + return TRUE; } static gboolean diff --git a/mono/metadata/sgen-gc.h b/mono/metadata/sgen-gc.h index 447bbcce597..a5b484900d4 100644 --- a/mono/metadata/sgen-gc.h +++ b/mono/metadata/sgen-gc.h @@ -548,7 +548,7 @@ gboolean sgen_collection_is_parallel (void) MONO_INTERNAL; gboolean sgen_collection_is_concurrent (void) MONO_INTERNAL; gboolean sgen_concurrent_collection_in_progress (void) MONO_INTERNAL; -void sgen_remember_major_object_for_concurrent_mark (char *obj) MONO_INTERNAL; +gboolean sgen_remember_major_object_for_concurrent_mark (char *obj) MONO_INTERNAL; typedef struct { CopyOrMarkObjectFunc copy_or_mark_object; diff --git a/mono/metadata/sgen-los.c b/mono/metadata/sgen-los.c index a138d482701..28432274e43 100644 --- a/mono/metadata/sgen-los.c +++ b/mono/metadata/sgen-los.c @@ -384,7 +384,8 @@ sgen_los_alloc_large_inner (MonoVTable *vtable, size_t size) los_consistency_check (); #endif - sgen_remember_major_object_for_concurrent_mark (obj->data); + if (sgen_remember_major_object_for_concurrent_mark (obj->data)) + sgen_los_pin_object (obj->data); return obj->data; } @@ -586,6 +587,7 @@ sgen_los_pin_object (char *data) { LOSObject *obj = sgen_los_header_for_object (data); obj->size = obj->size | 1; + binary_protocol_pin (data, (gpointer)SGEN_LOAD_VTABLE (data), sgen_safe_object_get_size ((MonoObject*)data)); } void diff --git a/mono/metadata/sgen-marksweep.c b/mono/metadata/sgen-marksweep.c index c42c742bb3c..05e44155852 100644 --- a/mono/metadata/sgen-marksweep.c +++ b/mono/metadata/sgen-marksweep.c @@ -765,8 +765,13 @@ alloc_obj (int size, gboolean pinned, gboolean has_references) *(void**)obj = NULL; #ifdef SGEN_CONCURRENT_MARK - if (obj) - sgen_remember_major_object_for_concurrent_mark (obj); + if (obj && sgen_remember_major_object_for_concurrent_mark (obj)) { + MSBlockInfo *block = MS_BLOCK_FOR_OBJ (obj); + int word, bit; + MS_CALC_MARK_BIT (word, bit, obj); + MS_SET_MARK_BIT (block, word, bit); + binary_protocol_mark (obj, NULL, size); + } #endif return obj; @@ -1315,7 +1320,6 @@ major_copy_or_mark_object (void **ptr, SgenGrayQueue *queue) } else { if (sgen_los_object_is_pinned (obj)) return; - binary_protocol_pin (obj, (gpointer)SGEN_LOAD_VTABLE (obj), sgen_safe_object_get_size ((MonoObject*)obj)); if (G_UNLIKELY (MONO_GC_OBJ_PINNED_ENABLED ())) { MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (obj); MONO_GC_OBJ_PINNED ((mword)obj, sgen_safe_object_get_size (obj), vt->klass->name_space, vt->klass->name, GENERATION_OLD); |