[runtime] Drop support for external libgc.
authorAlex Rønne Petersen <alexrp@xamarin.com>
Wed, 13 May 2015 09:05:38 +0000 (11:05 +0200)
committerAlex Rønne Petersen <alexrp@xamarin.com>
Fri, 15 May 2015 13:16:08 +0000 (15:16 +0200)
This has not been supported for a while, so remove it.

configure.ac
libgc/include/gc.h
mono/metadata/boehm-gc.c
mono/metadata/object.c
mono/mini/Makefile.am.in
mono/utils/gc_wrapper.h
msvc/mono.props
winconfig.h

index 1d40df3cc814a9802098ad6ce8f0f950998e96ad..a9fa6317873efd5a5cec6368290ae4122644ee91 100644 (file)
@@ -41,12 +41,6 @@ esac
 #
 libgc_configure_args=
 
-if test -d $srcdir/libgc ; then
-  libgc_default=included
-else
-  libgc_default=boehm
-fi
-
 # These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
 # libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
 CPPFLAGS_FOR_LIBGC=$CPPFLAGS
@@ -117,7 +111,6 @@ case "$host" in
                libmono_ldflags="-mms-bitfields -mwindows"
                libdl=
                libgc_threads=win32
-               libgc_default=included
                with_sigaltstack=no
                with_tls=pthread
                LN_S=cp
@@ -183,7 +176,6 @@ case "$host" in
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID)
                libdl=
-               libgc_default=boehm
                libgc_threads=pthreads
                with_sigaltstack=no
                use_sigposix=yes
@@ -258,7 +250,6 @@ case "$host" in
                libmono_cflags="-D_REENTRANT"
                libdl=
                libgc_threads=pthreads
-               libgc_default=boehm
                use_sigposix=yes
                ikvm_native=no
                AC_DEFINE(DISABLE_SOCKETS,1,[Disable sockets support])
@@ -1010,7 +1001,7 @@ dnl
 dnl Boehm GC configuration
 dnl
 
-AC_ARG_WITH(libgc,   [  --with-gc=boehm,included,none  Controls the Boehm GC config, default=included],[libgc=$with_gc],[libgc=$libgc_default])
+AC_ARG_WITH(libgc,   [  --with-gc=included,none  Controls the Boehm GC config, default=included],[libgc=$with_gc],[libgc=included])
 
 AC_ARG_ENABLE(boehm, [  --disable-boehm            Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
 AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
@@ -1020,55 +1011,13 @@ if test x$enable_parallel_mark = xyes; then
        libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
 fi
 
-gc_headers=no
 gc_msg=""
-use_included_gc=no
 LIBGC_CPPFLAGS=
 LIBGC_LIBS=
 LIBGC_STATIC_LIBS=
 libgc_dir=
 case "x$libgc" in
-       xboehm|xbohem|xyes)
-               AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
-               AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
-
-               if test "x$found_boehm" != "xyes"; then
-                       AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
-               fi
-               if test "x$gc_headers" != "xyes"; then
-                       AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
-               fi
-
-               LIBGC_LIBS="-lgc $libdl"
-               LIBGC_STATIC_LIBS="$LIBGC_LIBS"
-               libmono_ldflags="$libmono_ldflags -lgc"
-               BOEHM_DEFINES="-DHAVE_BOEHM_GC"
-
-               # AC_CHECK_FUNCS does not work for some reason...
-               AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
-               if test "x$found_gcj_malloc" = "xyes"; then
-                       BOEHM_DEFINES="-DHAVE_GC_GCJ_MALLOC $BOEHM_DEFINES"
-                       AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "System Boehm (with typed GC)", [GC description])
-                       gc_msg="System Boehm with typed GC"
-               else
-                       AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "System Boehm (no typed GC)", [GC description])
-                       gc_msg="System Boehm (without typed GC)"
-               fi
-               AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
-               if test "x$found_gc_enable" = "xyes"; then
-                       BOEHM_DEFINES="-DHAVE_GC_ENABLE $BOEHM_DEFINES"
-               fi
-
-               # check whether we need to explicitly allow
-               # thread registering
-               AC_CHECK_LIB(gc, GC_allow_register_threads, found_allow_register_threads="yes",,$libdl)
-               if test "x$found_allow_register_threads" = "xyes"; then
-                  AC_DEFINE(HAVE_GC_ALLOW_REGISTER_THREADS, 1, [GC requires thread registration])
-               fi
-               ;;
-
        xincluded)
-               use_included_gc=yes
                if test "x$support_boehm" = "xyes"; then
                        libgc_dir=libgc
                fi
@@ -1077,7 +1026,7 @@ case "x$libgc" in
                LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
                LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
 
-               BOEHM_DEFINES="-DHAVE_BOEHM_GC -DHAVE_GC_H -DUSE_INCLUDED_LIBGC -DHAVE_GC_GCJ_MALLOC -DHAVE_GC_ENABLE"
+               BOEHM_DEFINES="-DHAVE_BOEHM_GC"
 
                if test x$target_win32 = xyes; then
                        BOEHM_DEFINES="$BOEHM_DEFINES -DGC_NOT_DLL"
@@ -1093,6 +1042,10 @@ case "x$libgc" in
                fi
                ;;
 
+       xboehm|xbohem|xyes)
+               AC_MSG_WARN("External Boehm is no longer supported")
+               ;;
+
        xsgen)
                AC_MSG_WARN("Use --with-sgen instead, --with-gc= controls Boehm configuration")
                ;;
@@ -1113,7 +1066,6 @@ if test "x$large_heap" = "xyes"; then
    CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
 fi
 
-AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
 AC_SUBST(LIBGC_CPPFLAGS)
 AC_SUBST(LIBGC_LIBS)
 AC_SUBST(LIBGC_STATIC_LIBS)
@@ -3665,8 +3617,6 @@ AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
 AM_CONDITIONAL(HOST_ARM64, test x$HOST = xARM64)
 AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
 
-AM_CONDITIONAL(INCLUDED_LIBGC, test x$libgc = xincluded)
-
 AC_SUBST(LIBC)
 AC_SUBST(INTL)
 AC_SUBST(SQLITE)
index 2265fdbd34a71094805a5c568cc44e8ce70719f2..dd7fb7a86c8d0f90eda6eb4e6aaaa762a28129d9 100644 (file)
@@ -927,11 +927,7 @@ GC_API void (*GC_is_visible_print_proc)
 
 #if !defined(GC_USE_LD_WRAP) && \
     (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) || defined(GC_DARWIN_THREADS) || defined(GC_MACOSX_THREADS))
-#if defined(_IN_LIBGC) || defined(USE_INCLUDED_LIBGC)
 # include "gc_pthread_redirects.h"
-#else
-# include <gc/gc_pthread_redirects.h>
-#endif
 #endif
 
 # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \
index b0b50a531a5709fe76a95cd6d5ba4b83976792a6..8f381360e8dddbf950d0baacd7f0b13d264b4f69 100644 (file)
 
 #if HAVE_BOEHM_GC
 
-#ifdef USE_INCLUDED_LIBGC
 #undef TRUE
 #undef FALSE
 #define THREAD_LOCAL_ALLOC 1
 #include "private/pthread_support.h"
-#endif
 
 #if defined(PLATFORM_MACOSX) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
 void *pthread_get_stackaddr_np(pthread_t);
@@ -169,13 +167,7 @@ mono_gc_base_init (void)
        GC_finalize_on_demand = 1;
        GC_finalizer_notifier = mono_gc_finalize_notify;
 
-#ifdef HAVE_GC_GCJ_MALLOC
        GC_init_gcj_malloc (5, NULL);
-#endif
-
-#ifdef HAVE_GC_ALLOW_REGISTER_THREADS
-       GC_allow_register_threads();
-#endif
 
        if ((env = g_getenv ("MONO_GC_PARAMS"))) {
                char **ptr, **opts = g_strsplit (env, ",", -1);
@@ -336,13 +328,7 @@ mono_gc_get_heap_size (void)
 gboolean
 mono_gc_is_gc_thread (void)
 {
-#if GC_VERSION_MAJOR >= 7
-       return TRUE;
-#elif defined(USE_INCLUDED_LIBGC)
        return GC_thread_is_registered ();
-#else
-       return TRUE;
-#endif
 }
 
 extern int GC_thread_register_foreign (void *base_addr);
@@ -356,33 +342,13 @@ mono_gc_register_thread (void *baseptr)
 static void*
 boehm_thread_register (MonoThreadInfo* info, 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 NULL;
-       }
-       return info;
-#else
        if (mono_gc_is_gc_thread())
                return info;
-#if defined(USE_INCLUDED_LIBGC) && !defined(HOST_WIN32)
+#if !defined(HOST_WIN32)
        return GC_thread_register_foreign (baseptr) ? info : NULL;
 #else
        return NULL;
 #endif
-#endif
 }
 
 static void
@@ -399,11 +365,7 @@ boehm_thread_unregister (MonoThreadInfo *p)
 gboolean
 mono_object_is_alive (MonoObject* o)
 {
-#ifdef USE_INCLUDED_LIBGC
        return GC_is_marked ((gpointer)o);
-#else
-       return TRUE;
-#endif
 }
 
 int
@@ -412,8 +374,6 @@ mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data)
        return 1;
 }
 
-#ifdef USE_INCLUDED_LIBGC
-
 static gint64 gc_start_time;
 
 static void
@@ -500,15 +460,6 @@ mono_gc_enable_events (void)
        GC_on_heap_resize = on_gc_heap_resize;
 }
 
-#else
-
-void
-mono_gc_enable_events (void)
-{
-}
-
-#endif
-
 int
 mono_gc_register_root (char *start, size_t size, void *descr)
 {
@@ -587,15 +538,11 @@ mono_gc_make_descr_for_array (int vector, gsize *elem_bitmap, int numbits, size_
 void*
 mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits)
 {
-#ifdef HAVE_GC_GCJ_MALLOC
        /* It seems there are issues when the bitmap doesn't fit: play it safe */
        if (numbits >= 30)
                return GC_NO_DESCRIPTOR;
        else
                return (gpointer)GC_make_descriptor ((GC_bitmap)bitmap, numbits);
-#else
-       return NULL;
-#endif
 }
 
 void*
@@ -704,24 +651,16 @@ mono_gc_clear_domain (MonoDomain *domain)
 int
 mono_gc_get_suspend_signal (void)
 {
-#ifdef USE_INCLUDED_GC
        return GC_get_suspend_signal ();
-#else
-       return -1;
-#endif
 }
 
 int
 mono_gc_get_restart_signal (void)
 {
-#ifdef USE_INCLUDED_GC
        return GC_get_restart_signal ();
-#else
-       return -1;
-#endif
 }
 
-#if defined(USE_INCLUDED_LIBGC) && defined(USE_COMPILER_TLS) && defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+#if defined(USE_COMPILER_TLS) && defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
 extern __thread MONO_TLS_FAST void* GC_thread_tls;
 #include "metadata-internals.h"
 
@@ -1252,11 +1191,7 @@ mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void
 #ifdef HOST_WIN32
 BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved)
 {
-#ifdef USE_INCLUDED_LIBGC
        return GC_DllMain (module_handle, reason, reserved);
-#else
-       return TRUE;
-#endif
 }
 #endif
 
@@ -1279,9 +1214,7 @@ mono_gc_get_vtable_bits (MonoClass *class)
 void
 mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size)
 {
-#ifdef USE_INCLUDED_LIBGC
        GC_register_altstack (stack, stack_size, altstack, altstack_size);
-#endif
 }
 
 int
index b56dd2c82654d5527158b61fb5d1d8fb33086b82..3e134550c8790d84625bc9f484bd7112dbaaeeaf 100644 (file)
 #include <mono/utils/mono-memory-model.h>
 #include "cominterop.h"
 
-#ifdef HAVE_BOEHM_GC
+#if defined(HAVE_BOEHM_GC)
 #define NEED_TO_ZERO_PTRFREE 1
+#define GC_NO_DESCRIPTOR ((gpointer)(0 | GC_DS_LENGTH))
 #define ALLOC_PTRFREE(obj,vt,size) do { (obj) = GC_MALLOC_ATOMIC ((size)); (obj)->vtable = (vt); (obj)->synchronisation = NULL;} while (0)
 #define ALLOC_OBJECT(obj,vt,size) do { (obj) = GC_MALLOC ((size)); (obj)->vtable = (vt);} while (0)
-#ifdef HAVE_GC_GCJ_MALLOC
-#define GC_NO_DESCRIPTOR ((gpointer)(0 | GC_DS_LENGTH))
 #define ALLOC_TYPED(dest,size,type) do { (dest) = GC_GCJ_MALLOC ((size),(type)); } while (0)
-#else
-#define GC_NO_DESCRIPTOR (NULL)
-#define ALLOC_TYPED(dest,size,type) do { (dest) = GC_MALLOC ((size)); *(gpointer*)dest = (type);} while (0)
-#endif
-#else
-#ifdef HAVE_SGEN_GC
+#elif defined(HAVE_SGEN_GC)
 #define GC_NO_DESCRIPTOR (NULL)
 #define ALLOC_PTRFREE(obj,vt,size) do { (obj) = mono_gc_alloc_obj (vt, size);} while (0)
 #define ALLOC_OBJECT(obj,vt,size) do { (obj) = mono_gc_alloc_obj (vt, size);} while (0)
@@ -69,7 +63,6 @@
 #define ALLOC_OBJECT(obj,vt,size) do { (obj) = calloc (1, (size)); (obj)->vtable = (vt);} while (0)
 #define ALLOC_TYPED(dest,size,type) do { (dest) = calloc (1, (size)); *(gpointer*)dest = (type);} while (0)
 #endif
-#endif
 
 static MonoObject* mono_object_new_ptrfree (MonoVTable *vtable);
 static MonoObject* mono_object_new_ptrfree_box (MonoVTable *vtable);
@@ -964,21 +957,6 @@ mono_class_compute_gc_descriptor (MonoClass *class)
                mono_register_jit_icall (mono_object_new_fast, "mono_object_new_fast", mono_create_icall_signature ("object ptr"), FALSE);
                mono_register_jit_icall (mono_string_alloc, "mono_string_alloc", mono_create_icall_signature ("object int"), FALSE);
 
-#ifdef HAVE_GC_GCJ_MALLOC
-               /* 
-                * This is not needed unless the relevant code in mono_get_allocation_ftn () is 
-                * turned on.
-                */
-#if 0
-#ifdef GC_REDIRECT_TO_LOCAL
-               mono_register_jit_icall (GC_local_gcj_malloc, "GC_local_gcj_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
-               mono_register_jit_icall (GC_local_gcj_fast_malloc, "GC_local_gcj_fast_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
-#endif
-               mono_register_jit_icall (GC_gcj_malloc, "GC_gcj_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
-               mono_register_jit_icall (GC_gcj_fast_malloc, "GC_gcj_fast_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
-#endif
-
-#endif
                gcj_inited = TRUE;
                mono_loader_unlock ();
        }
index fb35bbdd94a115c989a562c67d28fc9be084b306..3d36929dc802e9115f54d1138449cc793b37bb25 100755 (executable)
@@ -3,13 +3,8 @@ mtest=for_loop
 monodir=$(top_builddir)
 
 # This is needed for automake dependency generation
-if INCLUDED_LIBGC
 libgc_libs=$(monodir)/libgc/libmonogc.la
 libgc_static_libs=$(monodir)/libgc/libmonogc-static.la
-else
-libgc_libs=$(LIBGC_LIBS)
-libgc_static_libs=$(LIBGC_STATIC_LIBS)
-endif
 
 libs=  \
        $(monodir)/mono/metadata/libmonoruntime.la      \
index 5b52087e28804a8947c307120ec087cc6e197544..11620b3a4254562fd97b205616e09edc6bdc8ccb 100644 (file)
@@ -25,7 +25,7 @@
         * it if it is the included one.
         */
        
-#      if defined(HAVE_KW_THREAD) && defined(USE_INCLUDED_LIBGC) && !defined(__powerpc__)
+#      if defined(HAVE_KW_THREAD) && !defined(__powerpc__)
         /* The local alloc stuff is in pthread_support.c, but solaris uses solaris_threads.c */
         /* It is also disabled on solaris/x86 by libgc/configure.ac */
         /* 
 #       endif
 #      endif
 
-#      ifdef HAVE_GC_GC_H
-#              include <gc/gc.h>
-#              include <gc/gc_typed.h>
-#              include <gc/gc_mark.h>
-#              include <gc/gc_gcj.h>
-#      elif defined(HAVE_GC_H) || defined(USE_INCLUDED_LIBGC)
-#              include <gc.h>
-#              include <gc_typed.h>
-#              include <gc_mark.h>
-#              include <gc_gcj.h>
-#      else
-#              error have boehm GC without headers, you probably need to install them by hand
-#      endif
+#      include <gc.h>
+#      include <gc_typed.h>
+#      include <gc_mark.h>
+#      include <gc_gcj.h>
 
 #if defined(HOST_WIN32)
 #define CreateThread GC_CreateThread
index 85e839475afd0dc5348b140da63696088fdc07fc..f1d9b277fc67966a32d4c0f18a8df1f5095451d9 100644 (file)
@@ -4,7 +4,7 @@
     <top_srcdir>$(MSBuildProjectDirectory)\..</top_srcdir>
     <LIBGC_CPPFLAGS_INCLUDE>$(top_srcdir)\libgc\include</LIBGC_CPPFLAGS_INCLUDE>
     <GLIB_CFLAGS_INCLUDE>$(top_srcdir)\eglib\src</GLIB_CFLAGS_INCLUDE>
-    <BOEHM_DEFINES>HAVE_BOEHM_GC;HAVE_GC_H;USE_INCLUDED_LIBGC;HAVE_GC_GCJ_MALLOC;HAVE_GC_ENABLE</BOEHM_DEFINES>
+    <BOEHM_DEFINES>HAVE_BOEHM_GC</BOEHM_DEFINES>
     <SGEN_DEFINES>HAVE_SGEN_GC;HAVE_MOVING_COLLECTOR;HAVE_WRITE_BARRIERS</SGEN_DEFINES>
   </PropertyGroup>
   <ItemDefinitionGroup>
index 1b3d494ebf663081cc845031560afa56ff892066..a47c844104d85cbdc2afbc4a495ca18a7a6aac9c 100644 (file)
 /* Define to 1 if you have the `fstatvfs' function. */
 /* #undef HAVE_FSTATVFS */
 
-/* Have GC_enable */
-/* #define HAVE_GC_ENABLE 1 */
-
-/* Have GC_gcj_malloc */
-/* #define HAVE_GC_GCJ_MALLOC 1 */
-
-/* Define to 1 if you have the <gc/gc.h> header file. */
-/* #undef HAVE_GC_GC_H */
-
-/* Have gc.h */
-/* #define HAVE_GC_H 1 */
-
 /* Define to 1 if you have the `getaddrinfo' function. */
 #define HAVE_GETADDRINFO 1