Add a few variants of the MONO_GC_REGISTER_ROOT () to make most roots precisely track...
[mono.git] / mono / metadata / threads.c
index ca9cc25f42a3a26e14a4318c7db8e37f5d3b30dc..53a93ff9661fdd562b1ae2da42408eb7c11112b9 100644 (file)
@@ -256,7 +256,7 @@ static gboolean handle_store(MonoThread *thread)
        }
 
        if(threads==NULL) {
-               MONO_GC_REGISTER_ROOT (threads);
+               MONO_GC_REGISTER_ROOT_FIXED (threads);
                threads=mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC);
        }
 
@@ -331,7 +331,7 @@ small_id_alloc (MonoInternalThread *thread)
 
        if (!small_id_table) {
                small_id_table_size = 2;
-               small_id_table = mono_gc_alloc_fixed (small_id_table_size * sizeof (MonoInternalThread*), NULL);
+               small_id_table = mono_gc_alloc_fixed (small_id_table_size * sizeof (MonoInternalThread*), mono_gc_make_root_descr_all_refs (small_id_table_size));
        }
        for (i = small_id_next; i < small_id_table_size; ++i) {
                if (!small_id_table [i]) {
@@ -353,7 +353,7 @@ small_id_alloc (MonoInternalThread *thread)
                if (new_size >= (1 << 16))
                        g_assert_not_reached ();
                id = small_id_table_size;
-               new_table = mono_gc_alloc_fixed (new_size * sizeof (MonoInternalThread*), NULL);
+               new_table = mono_gc_alloc_fixed (new_size * sizeof (MonoInternalThread*), mono_gc_make_root_descr_all_refs (new_size));
                memcpy (new_table, small_id_table, small_id_table_size * sizeof (void*));
                mono_gc_free_fixed (small_id_table);
                small_id_table = new_table;
@@ -834,7 +834,7 @@ static void
 register_thread_start_argument (MonoThread *thread, struct StartInfo *start_info)
 {
        if (thread_start_args == NULL) {
-               MONO_GC_REGISTER_ROOT (thread_start_args);
+               MONO_GC_REGISTER_ROOT_FIXED (thread_start_args);
                thread_start_args = mono_g_hash_table_new (NULL, NULL);
        }
        mono_g_hash_table_insert (thread_start_args, thread, start_info->start_arg);
@@ -866,7 +866,7 @@ MonoInternalThread* mono_thread_create_internal (MonoDomain *domain, gpointer fu
                return NULL;
        }
        if (threads_starting_up == NULL) {
-               MONO_GC_REGISTER_ROOT (threads_starting_up);
+               MONO_GC_REGISTER_ROOT_FIXED (threads_starting_up);
                threads_starting_up = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_KEY_VALUE_GC);
        }
 
@@ -1154,7 +1154,7 @@ HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this,
                mono_threads_lock ();
                register_thread_start_argument (this, start_info);
                if (threads_starting_up == NULL) {
-                       MONO_GC_REGISTER_ROOT (threads_starting_up);
+                       MONO_GC_REGISTER_ROOT_FIXED (threads_starting_up);
                        threads_starting_up = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_KEY_VALUE_GC);
                }
                mono_g_hash_table_insert (threads_starting_up, this, this);
@@ -2648,7 +2648,7 @@ ves_icall_System_Threading_Thread_VolatileWriteObject (void *ptr, void *value)
 void mono_thread_init (MonoThreadStartCB start_cb,
                       MonoThreadAttachCB attach_cb)
 {
-       MONO_GC_REGISTER_ROOT (small_id_table);
+       MONO_GC_REGISTER_ROOT_FIXED (small_id_table);
        InitializeCriticalSection(&threads_mutex);
        InitializeCriticalSection(&interlocked_mutex);
        InitializeCriticalSection(&contexts_mutex);