mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Use thread-local allocation (significant perf. improvement!); added the `boehm-gc.h' header.
* 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
This commit is contained in:
parent
8e7b3e9807
commit
e7bca22779
15 changed files with 65 additions and 16 deletions
|
@ -183,6 +183,7 @@ pkginclude_HEADERS = gh.h
|
|||
# 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 \
|
||||
|
|
39
libguile/boehm-gc.h
Normal file
39
libguile/boehm-gc.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
#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 */
|
|
@ -31,11 +31,10 @@
|
|||
|
||||
#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. */
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#define GC_THREADS 1
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
|
||||
#include "libguile/iselect.h"
|
||||
|
||||
|
|
|
@ -511,6 +511,8 @@ coop_condition_variable_destroy (coop_c *c)
|
|||
|
||||
#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)
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "libguile/gen-scmconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -55,7 +57,7 @@ extern unsigned long * __libc_ia64_register_backing_store_base;
|
|||
#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"
|
||||
|
@ -641,6 +643,13 @@ scm_storage_prehistory ()
|
|||
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
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "libguile/eval.h"
|
||||
|
||||
#include "libguile/guardians.h"
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#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);
|
||||
|
@ -98,7 +98,7 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr,
|
|||
{
|
||||
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
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#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
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
#include "libguile/smob.h"
|
||||
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
#include <gc/gc_mark.h>
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "libguile/__scm.h"
|
||||
#include "libguile/print.h"
|
||||
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "libguile/boehm-gc.h"
|
||||
#include "libguile/_scm.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "libguile/dynwind.h"
|
||||
#include "libguile/deprecation.h"
|
||||
|
||||
#include <gc/gc.h> /* disappearing links (aka. weak pointers) */
|
||||
#include "libguile/boehm-gc.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "libguile/validate.h"
|
||||
#include "libguile/weaks.h"
|
||||
|
||||
#include <gc/gc.h>
|
||||
#include "libguile/boehm-gc.h"
|
||||
#include <gc/gc_typed.h>
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue