Author: zoltan
Date: 2007-12-26 10:23:50 -0500 (Wed, 26 Dec 2007)
New Revision: 91897

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/boehm-gc.c
Log:
2007-12-26  Zoltan Varga  <[EMAIL PROTECTED]>

        * boehm-gc.c (mono_gc_register_thread): Use the new 
GC_register_my_thread () routine
        from GC 7.0 if available.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-12-26 15:02:47 UTC (rev 91896)
+++ trunk/mono/mono/metadata/ChangeLog  2007-12-26 15:23:50 UTC (rev 91897)
@@ -1,5 +1,8 @@
 2007-12-26  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * boehm-gc.c (mono_gc_register_thread): Use the new 
GC_register_my_thread () routine
+       from GC 7.0 if available.
+
        * object.c: Remove an unused define.
        
        * object.c (mono_class_compute_gc_descriptor): Fix a warning.

Modified: trunk/mono/mono/metadata/boehm-gc.c
===================================================================
--- trunk/mono/mono/metadata/boehm-gc.c 2007-12-26 15:02:47 UTC (rev 91896)
+++ trunk/mono/mono/metadata/boehm-gc.c 2007-12-26 15:23:50 UTC (rev 91897)
@@ -167,7 +167,9 @@
 gboolean
 mono_gc_is_gc_thread (void)
 {
-#ifdef USE_INCLUDED_LIBGC
+#if GC_VERSION_MAJOR >= 7
+       return TRUE;
+#elif defined(USE_INCLUDED_LIBGC)
        return GC_thread_is_registered ();
 #else
        return TRUE;
@@ -179,6 +181,25 @@
 gboolean
 mono_gc_register_thread (void *baseptr)
 {
+#if GC_VERSION_MAJOR >= 7
+       struct GC_stack_base sb;
+       int res;
+
+       res = GC_get_stack_base (&sb);
+       if (res != GC_SUCCESS) {
+               sb.mem_base = baseptr;
+#ifdef __ia64__
+               /* Can't determine the register stack bounds */
+               g_error ("mono_gc_register_thread failed ().\n");
+#endif
+       }
+       res = GC_register_my_thread (&sb);
+       if ((res != GC_SUCCESS) && (res != GC_DUPLICATE)) {
+               g_warning ("GC_register_my_thread () failed.\n");
+               return FALSE;
+       }
+       return TRUE;
+#else
        if (mono_gc_is_gc_thread())
                return TRUE;
 #if defined(USE_INCLUDED_LIBGC) && !defined(PLATFORM_WIN32)
@@ -186,6 +207,7 @@
 #else
        return FALSE;
 #endif
+#endif
 }
 
 gboolean

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to