From 184327a68d7aa6aa2576c398d324bd9def12ad67 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Mon, 27 Nov 2006 00:14:23 +0000 Subject: [PATCH] Turn "all interior pointers" off (slight performance gain). * libguile/gc.c (scm_storage_prehistory): Set `GC_all_interior_pointers' to 0. Register `scm_tc3_cons' and `scm_tc3_closure' as valid displacements. * libguile/struct.c (scm_alloc_struct): Register additional displacements. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-48 --- libguile/gc.c | 9 +++++++++ libguile/struct.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/libguile/gc.c b/libguile/gc.c index 31c1eab5b..afa8039ab 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -678,8 +678,17 @@ scm_getenv_int (const char *var, int def) void scm_storage_prehistory () { + GC_all_interior_pointers = 0; + GC_INIT (); + /* We only need to register a displacement for those types for which the + higher bits of the type tag are used to store a pointer (that is, a + pointer to an 8-octet aligned region). For `scm_tc3_struct', this is + handled in `scm_alloc_struct ()'. */ + GC_REGISTER_DISPLACEMENT (scm_tc3_cons); + GC_REGISTER_DISPLACEMENT (scm_tc3_closure); + /* Sanity check. */ if (!GC_is_visible (scm_sys_protects)) abort (); diff --git a/libguile/struct.c b/libguile/struct.c index a31ab0629..38331dd0f 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -311,6 +311,12 @@ scm_alloc_struct (int n_words, int n_extra, const char *what) p[scm_struct_i_n_words] = n_words; p[scm_struct_i_flags] = 0; + /* Since `SCM' objects will record either P or P + SCM_TC3_STRUCT, we need + to register them as valid displacements. Fortunately, only a handful of + N_EXTRA values are used in core Guile. */ + GC_REGISTER_DISPLACEMENT ((char *)p - (char *)block); + GC_REGISTER_DISPLACEMENT ((char *)p - (char *)block + scm_tc3_struct); + return p; }