Get rid of the mach_port field from SgenThreadInfo, its already available in the...
authorZoltan Varga <vargaz@gmail.com>
Mon, 22 Oct 2012 13:03:25 +0000 (15:03 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 22 Oct 2012 13:03:25 +0000 (15:03 +0200)
mono/metadata/sgen-gc.c
mono/metadata/sgen-gc.h
mono/metadata/sgen-os-mach.c

index 4d9eca352a94abfbc0a5b8dea6e40f74b7d34a56..5cbc257fc6b564ff55000bd942a833c5dfc3e1c0 100644 (file)
@@ -3737,10 +3737,6 @@ sgen_thread_register (SgenThreadInfo* info, void *addr)
        store_remset_buffer_index_addr = &store_remset_buffer_index;
 #endif
 
-#if defined(__MACH__)
-       info->mach_port = mach_thread_self ();
-#endif
-
        /* try to get it with attributes first */
 #if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK)
        {
@@ -3836,10 +3832,6 @@ sgen_thread_unregister (SgenThreadInfo *p)
        binary_protocol_thread_unregister ((gpointer)mono_thread_info_get_tid (p));
        DEBUG (3, fprintf (gc_debug_file, "unregister thread %p (%p)\n", p, (gpointer)mono_thread_info_get_tid (p)));
 
-#if defined(__MACH__)
-       mach_port_deallocate (current_task (), p->mach_port);
-#endif
-
        if (gc_callbacks.thread_detach_func) {
                gc_callbacks.thread_detach_func (p->runtime_data);
                p->runtime_data = NULL;
index caff3a46c741e9fa28c53acd646827ef421df2e0..8539a0aeaba16803e54e05516d2b485c39031a4c 100644 (file)
@@ -50,10 +50,6 @@ typedef struct _SgenThreadInfo SgenThreadInfo;
 #include <mono/metadata/sgen-gray.h>
 #include <mono/metadata/sgen-hash-table.h>
 
-#if defined(__MACH__)
-       #include <mach/mach_port.h>
-#endif
-
 /* The method used to clear the nursery */
 /* Clearing at nursery collections is the safest, but has bad interactions with caches.
  * Clearing at TLAB creation is much faster, but more complex and it might expose hard
@@ -105,14 +101,11 @@ enum {
 };
 
 /* eventually share with MonoThread? */
+/*
+ * This structure extends the MonoThreadInfo structure.
+ */
 struct _SgenThreadInfo {
        MonoThreadInfo info;
-#if defined(__MACH__)
-       thread_port_t mach_port;
-#else
-       int signal;
-       unsigned int stop_count; /* to catch duplicate signals */
-#endif
        int skip;
        volatile int in_critical_region;
        gboolean joined_stw;
@@ -131,6 +124,11 @@ struct _SgenThreadInfo {
        RememberedSet *remset;
        gpointer runtime_data;
 
+       /* Only used on POSIX platforms */
+       int signal;
+       /* Ditto */
+       unsigned int stop_count; /* to catch duplicate signals */
+
        gpointer stopped_ip;    /* only valid if the thread is stopped */
        MonoDomain *stopped_domain; /* ditto */
 
index 4efee0f4a5a944e647dde1feb893956efe5c65e5..868f798261c231df1a875cc88af6dd25e4c5f79a 100644 (file)
@@ -47,7 +47,7 @@
 gboolean
 sgen_resume_thread (SgenThreadInfo *info)
 {
-       return thread_resume (info->mach_port) == KERN_SUCCESS;
+       return thread_resume (info->info.native_handle) == KERN_SUCCESS;
 }
 
 gboolean
@@ -64,11 +64,11 @@ sgen_suspend_thread (SgenThreadInfo *info)
        state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
        mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
-       ret = thread_suspend (info->mach_port);
+       ret = thread_suspend (info->info.native_handle);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
-       ret = mono_mach_arch_get_thread_state (info->mach_port, state, &num_state);
+       ret = mono_mach_arch_get_thread_state (info->info.native_handle, state, &num_state);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
@@ -140,7 +140,7 @@ sgen_thread_handshake (BOOL suspend)
                        g_assert (info->doing_handshake);
                        info->doing_handshake = FALSE;
 
-                       ret = thread_resume (info->mach_port);
+                       ret = thread_resume (info->info.native_handle);
                        if (ret != KERN_SUCCESS)
                                continue;
                }