wingo pushed a commit to branch wip-whippet
in repository guile.

commit ddef73d03fdb2c11f53df635aadfdd181512faf7
Author: Andy Wingo <wi...@pobox.com>
AuthorDate: Thu May 15 16:13:18 2025 +0200

    Remove the last direct uses of BDW API
    
    * configure.ac: Remove code to detect BDW, that is taken care of by the
    whippet macros.  Remove support for ia64, for the moment at least,
    perhaps for good.
    * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS):
    Remove BDW cflags.
    (modinclude_HEADERS): Remove bdw-gc.h.
    * libguile/bdw-gc.h: Remove.
    * libguile/fluids.c:
    * libguile/hashtab.c:
    * libguile/numbers.c:
    * libguile/smob.c:
    * libguile/srfi-4.c:
    * libguile/struct.c:
    * libguile/vectors.c:
    * libguile/vm.c: Remove bdw-gc.h includes.
    * meta/guile-4.0-uninstalled.pc.in (Libs):
    * meta/guile-4.0.pc.in (Libs): Remove direct dependency on BDW-GC, as it
    is all encapsulated through Whippet, which is not publically exposed.
---
 configure.ac                     | 30 ++-----------------
 libguile/Makefile.am             |  3 +-
 libguile/bdw-gc.h                | 65 ----------------------------------------
 libguile/fluids.c                |  1 -
 libguile/hashtab.c               |  1 -
 libguile/numbers.c               |  3 +-
 libguile/smob.c                  |  1 -
 libguile/srfi-4.c                |  3 +-
 libguile/struct.c                |  1 -
 libguile/vectors.c               |  1 -
 libguile/vm.c                    |  3 --
 meta/guile-4.0-uninstalled.pc.in |  6 ++--
 meta/guile-4.0.pc.in             |  6 ++--
 13 files changed, 11 insertions(+), 113 deletions(-)

diff --git a/configure.ac b/configure.ac
index a2b9f41ad..3a31f0f0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1109,36 +1109,10 @@ main (int argc, char **argv)
 WHIPPET_PKG_COLLECTOR(bdw)
 WHIPPET_PKG
 
-#--------------------------------------------------------------------
-#
-# Boehm's GC library
-#
-#--------------------------------------------------------------------
-AC_MSG_CHECKING(for which bdw-gc pkg-config file to use)
-AC_ARG_WITH(bdw_gc, [  --with-bdw-gc=PKG       name of BDW-GC pkg-config file],
-            [bdw_gc="$withval"], [bdw_gc=bdw-gc])
-AC_MSG_RESULT($bdw_gc)
-PKG_CHECK_MODULES([BDW_GC], [$bdw_gc >= 7.2])
-
-save_LIBS="$LIBS"
-LIBS="$BDW_GC_LIBS $LIBS"
-CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
-
-# Functions that might not be defined, depending on configuration.
-AC_CHECK_FUNCS([GC_pthread_exit GC_pthread_cancel GC_pthread_sigmask])
-
-# Functions from GC 7.3.
-AC_CHECK_FUNCS([GC_move_disappearing_link GC_is_heap_ptr])
-
-# See if there's an auxiliary stack, as in ia64.
-AC_CHECK_MEMBER([struct GC_stack_base.reg_base],
-  [SCM_I_GSC_HAVE_AUXILIARY_STACK=1], [SCM_I_GSC_HAVE_AUXILIARY_STACK=0],
-  [#include <gc/gc.h>])
+# Machines with an auxiliary stack (ia64) are not supported.
+SCM_I_GSC_HAVE_AUXILIARY_STACK=0
 AC_SUBST([SCM_I_GSC_HAVE_AUXILIARY_STACK])
 
-LIBS="$save_LIBS"
-
-
 AC_CHECK_SIZEOF(float)
 if test "$ac_cv_sizeof_float" -le "$ac_cv_sizeof_long"; then
     AC_DEFINE([SCM_SINGLES], 1,
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 403444f64..21ea143a5 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -546,7 +546,7 @@ libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD =              
\
 version_info = 
@LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
 
 libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS =        \
-  $(BDW_GC_LIBS) $(LIBFFI_LIBS)                        \
+  $(LIBFFI_LIBS)                               \
   $(CEIL_LIBM)                                 \
   $(FLOOR_LIBM)                                        \
   $(FREXP_LIBM)                                        \
@@ -594,7 +594,6 @@ modinclude_HEADERS =                                \
        async.h                                 \
        atomic.h                                \
        backtrace.h                             \
-       bdw-gc.h                                \
        boolean.h                               \
        bitvectors.h                            \
        bytevectors.h                           \
diff --git a/libguile/bdw-gc.h b/libguile/bdw-gc.h
deleted file mode 100644
index 3107ebcef..000000000
--- a/libguile/bdw-gc.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef SCM_BDW_GC_H
-#define SCM_BDW_GC_H
-
-/* Copyright 2006,2008-2009,2011-2014,2018
-     Free Software Foundation, Inc.
-
-   This file is part of Guile.
-
-   Guile is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Lesser General Public License as published
-   by the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   Guile is distributed in the hope that it will be useful, but WITHOUT
-   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
-   License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with Guile.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* Correct header inclusion.  */
-
-#include "libguile/scmconfig.h"
-
-#if SCM_USE_PTHREAD_THREADS
-
-/* When pthreads are used, let `libgc' know about it and redirect allocation
-   calls such as `GC_MALLOC ()' to (contention-free, faster) thread-local
-   allocation.  */
-
-# define GC_THREADS 1
-# define GC_REDIRECT_TO_LOCAL 1
-
-/* Don't #define pthread routines to their GC_pthread counterparts.
-   Instead we will be careful inside Guile to use the GC_pthread
-   routines.  */
-# define GC_NO_THREAD_REDIRECTS 1
-
-#ifdef __MINGW32__
-/* Rely on pthreads-w32.  */
-#define GC_WIN32_PTHREADS
-#endif
-
-#endif
-
-#include <gc/gc.h>
-
-/* Return true if PTR points to the heap.  */
-#define SCM_I_IS_POINTER_TO_THE_HEAP(ptr)      \
-  (GC_base (ptr) != NULL)
-
-/* Register a disappearing link for the object pointed to by OBJ such that
-   the pointer pointed to be LINK is cleared when OBJ is reclaimed.  Do so
-   only if OBJ actually points to the heap.  See
-   
http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2563
-   for details.  */
-#define SCM_I_REGISTER_DISAPPEARING_LINK(link, obj)            \
-  ((SCM_I_IS_POINTER_TO_THE_HEAP (obj))                                \
-   ? GC_GENERAL_REGISTER_DISAPPEARING_LINK ((link), (obj))     \
-   : 0)
-
-
-#endif /* SCM_BDW_GC_H */
diff --git a/libguile/fluids.c b/libguile/fluids.c
index 6de7b83f7..b95930782 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -26,7 +26,6 @@
 
 #include "alist.h"
 #include "atomics-internal.h"
-#include "bdw-gc.h"
 #include "cache-internal.h"
 #include "deprecation.h"
 #include "dynwind.h"
diff --git a/libguile/hashtab.c b/libguile/hashtab.c
index 09738436c..c96961c2e 100644
--- a/libguile/hashtab.c
+++ b/libguile/hashtab.c
@@ -28,7 +28,6 @@
 #include <stdio.h>
 
 #include "alist.h"
-#include "bdw-gc.h"
 #include "boolean.h"
 #include "deprecation.h"
 #include "eq.h"
diff --git a/libguile/numbers.c b/libguile/numbers.c
index ae2aa7766..80ace24f6 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -1,4 +1,4 @@
-/* Copyright 1995-2016,2018-2022
+/* Copyright 1995-2016,2018-2022,2025
      Free Software Foundation, Inc.
 
    Portions Copyright 1990-1993 by AT&T Bell Laboratories and Bellcore.
@@ -57,7 +57,6 @@
 #include <complex.h>
 #endif
 
-#include "bdw-gc.h"
 #include "boolean.h"
 #include "deprecation.h"
 #include "dynwind.h"
diff --git a/libguile/smob.c b/libguile/smob.c
index ed15186a4..8b8091c04 100644
--- a/libguile/smob.c
+++ b/libguile/smob.c
@@ -30,7 +30,6 @@
 
 #include "async.h"
 #include "atomics-internal.h"
-#include "bdw-gc.h"
 #include "finalizers.h"
 #include "goops.h"
 #include "gsubr.h"
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 23896c32c..48f90f0b6 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -1,6 +1,6 @@
 /* srfi-4.c --- Uniform numeric vector datatypes.
 
-   Copyright 2001,2004,2006,2009-2011,2014,2018
+   Copyright 2001,2004,2006,2009-2011,2014,2018,2025
      Free Software Foundation, Inc.
 
    This file is part of Guile.
@@ -25,7 +25,6 @@
 
 #include <string.h>
 
-#include "bdw-gc.h"
 #include "boolean.h"
 #include "bytevectors.h"
 #include "error.h"
diff --git a/libguile/struct.c b/libguile/struct.c
index f41859cda..82329ec76 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -31,7 +31,6 @@
 
 #include "alist.h"
 #include "async.h"
-#include "bdw-gc.h"
 #include "boolean.h"
 #include "chars.h"
 #include "deprecation.h"
diff --git a/libguile/vectors.c b/libguile/vectors.c
index d81dc61a7..a2a620b79 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -27,7 +27,6 @@
 #include <string.h>
 
 #include "array-handle.h"
-#include "bdw-gc.h"
 #include "boolean.h"
 #include "deprecation.h"
 #include "eq.h"
diff --git a/libguile/vm.c b/libguile/vm.c
index acdc0ad8f..cb46c54cc 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -39,7 +39,6 @@
 #include "async.h"
 #include "atomic.h"
 #include "atomics-internal.h"
-#include "bdw-gc.h"
 #include "cache-internal.h"
 #include "continuations.h"
 #include "control.h"
@@ -79,8 +78,6 @@
 
 #include "vm.h"
 
-#include <gc/gc_mark.h>
-
 #if (defined __GNUC__)
 # define SCM_NOINLINE __attribute__ ((__noinline__))
 #else
diff --git a/meta/guile-4.0-uninstalled.pc.in b/meta/guile-4.0-uninstalled.pc.in
index 725c74c24..d326da4a8 100644
--- a/meta/guile-4.0-uninstalled.pc.in
+++ b/meta/guile-4.0-uninstalled.pc.in
@@ -4,9 +4,9 @@ srcdir=@abs_top_srcdir@
 Name: GNU Guile (uninstalled)
 Description: GNU's Ubiquitous Intelligent Language for Extension (uninstalled)
 Version: @GUILE_VERSION@
-Libs: -L${builddir}/libguile -lguile-@GUILE_EFFECTIVE_VERSION@ @BDW_GC_LIBS@
+Libs: -L${builddir}/libguile -lguile-@GUILE_EFFECTIVE_VERSION@
 Libs.private: @LIB_CLOCK_GETTIME@ @LIB_GETRANDOM@ @LIBGMP@ @LIBLTDL@   \
   @LIBFFI_LIBS@ @LIBUNISTRING@ @GUILE_LIBS@ @LIBICONV@ @LIBINTL@       \
   @LIBSOCKET@ @SERVENT_LIB@ @HOSTENT_LIB@ @GETADDRINFO_LIB@            \
-  @INET_NTOP_LIB@ @INET_PTON_LIB@
-Cflags: -I${srcdir} -I${builddir} @GUILE_CFLAGS@ @BDW_GC_CFLAGS@
+  @INET_NTOP_LIB@ @INET_PTON_LIB@ @WHIPPET_BDW_LIBS@
+Cflags: -I${srcdir} -I${builddir} @GUILE_CFLAGS@
diff --git a/meta/guile-4.0.pc.in b/meta/guile-4.0.pc.in
index 202868589..82e9b125d 100644
--- a/meta/guile-4.0.pc.in
+++ b/meta/guile-4.0.pc.in
@@ -22,9 +22,9 @@ guile=${bindir}/@guile@
 Name: GNU Guile
 Description: GNU's Ubiquitous Intelligent Language for Extension
 Version: @GUILE_VERSION@
-Libs: -L${libdir} -lguile-@GUILE_EFFECTIVE_VERSION@ @BDW_GC_LIBS@
+Libs: -L${libdir} -lguile-@GUILE_EFFECTIVE_VERSION@
 Libs.private: @LIB_CLOCK_GETTIME@ @LIB_GETRANDOM@ @LIBGMP@ @LIBLTDL@   \
   @LIBFFI_LIBS@ @LIBUNISTRING@ @GUILE_LIBS@ @LIBICONV@ @LIBINTL@       \
   @LIBSOCKET@ @SERVENT_LIB@ @HOSTENT_LIB@ @GETADDRINFO_LIB@            \
-  @INET_NTOP_LIB@ @INET_PTON_LIB@
-Cflags: -I${pkgincludedir}/@GUILE_EFFECTIVE_VERSION@ @GUILE_CFLAGS@ 
@BDW_GC_CFLAGS@
+  @INET_NTOP_LIB@ @INET_PTON_LIB@ @WHIPPET_BDW_LIBS@
+Cflags: -I${pkgincludedir}/@GUILE_EFFECTIVE_VERSION@ @GUILE_CFLAGS@

Reply via email to