[sgen] Move `gc_disabled` to Mono-specific code.
authorMark Probst <mark.probst@gmail.com>
Tue, 30 Dec 2014 19:38:30 +0000 (11:38 -0800)
committerMark Probst <mark.probst@gmail.com>
Wed, 29 Apr 2015 17:57:55 +0000 (10:57 -0700)
mono/metadata/sgen-client-mono.h
mono/metadata/sgen-gc.c
mono/metadata/sgen-gc.h
mono/metadata/sgen-mono.c
mono/metadata/sgen-os-mach.c
mono/metadata/sgen-os-posix.c
mono/metadata/sgen-os-win32.c
mono/metadata/sgen-stw.c

index dea937cce44970125d96c905f94e125d1911fef2..b9eae28e33cd2235bafcfc9a4b2e7bcdcc72897d 100644 (file)
@@ -109,6 +109,15 @@ struct _SgenClientThreadInfo {
 
        gpointer stopped_ip;    /* only valid if the thread is stopped */
        MonoDomain *stopped_domain; /* dsto */
+
+       /*
+       This is set the argument of mono_gc_set_skip_thread.
+
+       A thread that knowingly holds no managed state can call this
+       function around blocking loops to reduce the GC burden by not
+       been scanned.
+       */
+       gboolean gc_disabled;
 };
 
 #else
index 1a139dd61f79993645c620f00f2396ed8945c395..f455884391bac98ca255ce0e136dabb23b4ba1c1 100644 (file)
@@ -3675,15 +3675,6 @@ sgen_get_major_collector (void)
        return &major_collector;
 }
 
-void mono_gc_set_skip_thread (gboolean skip)
-{
-       SgenThreadInfo *info = mono_thread_info_current ();
-
-       LOCK_GC;
-       info->gc_disabled = skip;
-       UNLOCK_GC;
-}
-
 SgenRememberedSet*
 sgen_get_remset (void)
 {
index 6d4526a52b03f6587f345034f12986fcecee468e..016696819492d17ccef224df1d4d74f339b55252 100644 (file)
@@ -389,14 +389,6 @@ void sgen_init_internal_allocator (void);
 struct _SgenThreadInfo {
        SgenClientThreadInfo client_info;
 
-       /*
-       This is set the argument of mono_gc_set_skip_thread.
-
-       A thread that knowingly holds no managed state can call this
-       function around blocking loops to reduce the GC burden by not
-       been scanned.
-       */
-       gboolean gc_disabled;
        void *stack_end;
        void *stack_start;
        void *stack_start_limit;
index e094205358d0a7430bfd615f0e87377806c2a59a..ae9eb24fe78a3d40648da1d3c8ed88a2cef35947 100644 (file)
@@ -1972,6 +1972,16 @@ sgen_client_thread_register (SgenThreadInfo* info, void *stack_bottom_fallback)
        info->client_info.stopped_domain = NULL;
 }
 
+void
+mono_gc_set_skip_thread (gboolean skip)
+{
+       SgenThreadInfo *info = mono_thread_info_current ();
+
+       LOCK_GC;
+       info->client_info.gc_disabled = skip;
+       UNLOCK_GC;
+}
+
 static gboolean
 is_critical_method (MonoMethod *method)
 {
@@ -2030,7 +2040,7 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
                        SGEN_LOG (3, "Skipping dead thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
                        continue;
                }
-               if (info->gc_disabled) {
+               if (info->client_info.gc_disabled) {
                        SGEN_LOG (3, "GC disabled for thread %p, range: %p-%p, size: %td", info, info->stack_start, info->stack_end, (char*)info->stack_end - (char*)info->stack_start);
                        continue;
                }
index eed558b976be6ec783cad9c4845819f45ee53b79..2aae07ce8125356eb5e21e784095407dee50beee 100644 (file)
@@ -120,7 +120,7 @@ sgen_thread_handshake (BOOL suspend)
                        continue;
 
                info->client_info.suspend_done = FALSE;
-               if (info->gc_disabled)
+               if (info->client_info.gc_disabled)
                        continue;
 
                if (suspend) {
index ef86a883820d6c1b29a712927f3589b8c833eac4..edba9aa1d03f25ce3850961a2bf7ec23ea41a6f9 100644 (file)
@@ -209,7 +209,7 @@ sgen_thread_handshake (BOOL suspend)
                        continue;
                }
                info->client_info.suspend_done = FALSE;
-               if (info->gc_disabled)
+               if (info->client_info.gc_disabled)
                        continue;
                /*if (signum == suspend_signal_num && info->stop_count == global_stop_count)
                        continue;*/
index b4927e5d5a8b934814b7ddd3f23d60804204c455..61d64c075af25b2a78a420afe0f6481cea7b75fa 100644 (file)
@@ -132,7 +132,7 @@ sgen_thread_handshake (BOOL suspend)
                if (info == current)
                        continue;
                info->client_info.suspend_done = FALSE;
-               if (info->gc_disabled)
+               if (info->client_info.gc_disabled)
                        continue;
                if (suspend) {
                        if (!sgen_suspend_thread (info))
index 431eeeec319676e480cbde07ff8e623004c77166..85cf2d31d56fb025e23eebb36b60643686b610c8 100644 (file)
@@ -120,7 +120,7 @@ restart_threads_until_none_in_managed_allocator (void)
                   allocator */
                FOREACH_THREAD_SAFE (info) {
                        gboolean result;
-                       if (info->client_info.skip || info->gc_disabled || info->client_info.suspend_done)
+                       if (info->client_info.skip || info->client_info.gc_disabled || info->client_info.suspend_done)
                                continue;
                        if (mono_thread_info_is_live (info) &&
                                        (!info->stack_start || info->client_info.in_critical_region || info->client_info.info.inside_critical_region ||
@@ -327,7 +327,7 @@ sgen_is_thread_in_current_stw (SgenThreadInfo *info)
        This is used by TP and finalizer threads.
        FIXME Use an atomic variable for this to avoid everyone taking the GC LOCK.
        */
-       if (info->gc_disabled) {
+       if (info->client_info.gc_disabled) {
                return FALSE;
        }