* libguile/Makefile.am (modinclude_HEADERS): Added `boehm-gc.h'.
* libguile/coop-defs.h: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.
* libguile/coop-threads.h: Likewise.
* libguile/coop.c: Likewise.
* libguile/gc.c: Likewise.
(scm_storage_prehistory): Invoke `GC_init ()'.
* libguile/guardians.c: Use "libguile/boehm-gc.h" instead of <gc/gc.h>.
* libguile/inline.h: Likewise.
(scm_double_cell): Use `GC_MALLOC' instead of `GC_malloc'.
* libguile/pthread-threads.h: Use "libguile/boehm-gc.h" instead of
<gc/gc.h>.
* libguile/smob.c: Likewise.
* libguile/smob.h: Likewise.
* libguile/struct.c: Likewise.
* libguile/threads.c: Likewise.
* libguile/weaks.c: Likewise.
git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-51
# These are headers visible as <libguile/mumble.h>.
modincludedir = $(includedir)/libguile
modinclude_HEADERS = __scm.h alist.h arbiters.h async.h backtrace.h \
+ boehm-gc.h \
boolean.h chars.h continuations.h convert.h debug.h debug-malloc.h \
deprecation.h deprecated.h discouraged.h dynl.h dynwind.h \
environments.h eq.h error.h eval.h evalext.h extensions.h \
--- /dev/null
+#ifndef SCM_BOEHM_GC_H
+#define SCM_BOEHM_GC_H
+
+/* Copyright (C) 2006 Free Software Foundation, Inc.
+ *
+ * This library 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 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Correct header inclusion. */
+
+#include "libguile/gen-scmconfig.h"
+
+#ifdef SCM_I_GSC_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
+
+#endif
+
+#include <gc/gc.h>
+#include <gc/gc_local_alloc.h>
+
+#endif /* SCM_BOEHM_GC_H */
#ifdef GUILE_PTHREAD_COMPAT
# include <pthread.h>
-
-# define GC_THREADS 1
-# include <gc/gc.h>
#endif
+#include "libguile/boehm-gc.h"
+
/* This file is included by threads.h, which, in turn, is included by
libguile.h while coop-threads.h only is included by
coop-threads.c. */
#include <pthread.h>
-#define GC_THREADS 1
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
#include "libguile/iselect.h"
#ifdef GUILE_PTHREAD_COMPAT
+#include "libguile/boehm-gc.h"
+
/* 1K room for the cond wait routine */
#if SCM_STACK_GROWS_UP
# define COOP_STACK_ROOM (256)
# include <config.h>
#endif
+#include "libguile/gen-scmconfig.h"
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "libguile/gc.h"
#include "libguile/dynwind.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
#ifdef GUILE_DEBUG_MALLOC
#include "libguile/debug-malloc.h"
GC_all_interior_pointers = 0;
GC_INIT ();
+
+#ifdef SCM_I_GSC_USE_PTHREAD_THREADS
+ /* When using GC 6.8, this call is required to initialize thread-local
+ freelists (shouldn't be necessary with GC 7.0). */
+ GC_init ();
+#endif
+
GC_expand_hp (SCM_DEFAULT_INIT_HEAP_SIZE_2);
/* We only need to register a displacement for those types for which the
#include "libguile/eval.h"
#include "libguile/guardians.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
#include "libguile/pairs.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
SCM_API SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
{
SCM z;
- z = SCM_PACK ((scm_t_bits) (GC_malloc (2 * sizeof (scm_t_cell))));
+ z = SCM_PACK ((scm_t_bits) (GC_MALLOC (2 * sizeof (scm_t_cell))));
/* Initialize the type slot last so that the cell is ignored by the
GC until it is completely initialized. This is only relevant
when the GC can actually run during this code, which it can't
#include <sched.h>
/* `libgc' intercepts pthread calls by defining wrapping macros. */
-#define GC_THREADS 1
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
/* Threads
*/
#include "libguile/smob.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
#include <gc/gc_mark.h>
#include "libguile/__scm.h"
#include "libguile/print.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
\f
#include <string.h>
#endif
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
\f
#define _GNU_SOURCE
+#include "libguile/boehm-gc.h"
#include "libguile/_scm.h"
#if HAVE_UNISTD_H
#include "libguile/dynwind.h"
#include "libguile/deprecation.h"
-#include <gc/gc.h> /* disappearing links (aka. weak pointers) */
+#include "libguile/boehm-gc.h"
\f
#include "libguile/validate.h"
#include "libguile/weaks.h"
-#include <gc/gc.h>
+#include "libguile/boehm-gc.h"
#include <gc/gc_typed.h>