summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-01 17:36:21 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-01 17:50:05 +0100
commit0f595d7d1d57b12036bef801538163d3773567c3 (patch)
tree330a6988c41a3241a117232c665d4685400db513
parent764246cfbbfff21b3127fff500e972e1dc4314e3 (diff)
Use accessors instead of symbols deprecated in libgc 7.3.
* configure.ac: Check for `GC_set_all_interior_pointers', `GC_get_gc_no', and `GC_set_java_finalization'. * libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'. (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use `GC_set_all_interior_pointers'. * libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]: Use `GC_set_java_finalization'.
-rw-r--r--configure.ac7
-rw-r--r--libguile/gc.c16
-rw-r--r--libguile/guardians.c8
3 files changed, 28 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 8848339f8..cbad0a162 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1229,7 +1229,12 @@ save_LIBS="$LIBS"
LIBS="$BDW_GC_LIBS $LIBS"
CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
-AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_heap_usage_safe GC_get_free_space_divisor GC_gcollect_and_unmap GC_get_unmapped_bytes GC_set_finalizer_notifier GC_set_finalize_on_demand])
+AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit \
+ GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask \
+ GC_set_start_callback GC_get_heap_usage_safe \
+ GC_get_free_space_divisor GC_gcollect_and_unmap GC_get_unmapped_bytes \
+ GC_set_finalizer_notifier GC_set_finalize_on_demand \
+ GC_set_all_interior_pointers GC_get_gc_no GC_set_java_finalization])
# Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
# declared, and has a different type (returning void instead of
diff --git a/libguile/gc.c b/libguile/gc.c
index 06b5044e5..6e459c3f9 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006,
+ * 2008, 2009, 2010, 2011, 2012, 2013 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
@@ -317,7 +318,13 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
GC_get_heap_usage_safe (&heap_size, &free_bytes, &unmapped_bytes,
&bytes_since_gc, &total_bytes);
+#ifdef HAVE_GC_GET_GC_NO
+ /* This function was added in 7.2alpha2 (June 2009). */
+ gc_times = GC_get_gc_no ();
+#else
+ /* This symbol is deprecated as of 7.3. */
gc_times = GC_gc_no;
+#endif
answer =
scm_list_n (scm_cons (sym_gc_time_taken, scm_from_long (gc_time_taken)),
@@ -629,7 +636,14 @@ GC_set_finalize_on_demand (int foo)
void
scm_storage_prehistory ()
{
+#ifdef HAVE_GC_SET_ALL_INTERIOR_POINTERS
+ /* This function was added in 7.2alpha2 (June 2009). */
+ GC_set_all_interior_pointers (0);
+#else
+ /* This symbol is deprecated in 7.3. */
GC_all_interior_pointers = 0;
+#endif
+
free_space_divisor = scm_getenv_int ("GC_FREE_SPACE_DIVISOR", 3);
minimum_free_space_divisor = free_space_divisor;
target_free_space_divisor = free_space_divisor;
diff --git a/libguile/guardians.c b/libguile/guardians.c
index 022f54e63..6ba8c0b59 100644
--- a/libguile/guardians.c
+++ b/libguile/guardians.c
@@ -1,5 +1,5 @@
/* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009, 2011,
- * 2012 Free Software Foundation, Inc.
+ * 2012, 2013 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
@@ -351,7 +351,13 @@ void
scm_init_guardians ()
{
/* We use unordered finalization `a la Java. */
+#ifdef HAVE_GC_SET_JAVA_FINALIZATION
+ /* This function was added in 7.2alpha2 (June 2009). */
+ GC_set_java_finalization (1);
+#else
+ /* This symbol is deprecated as of 7.3. */
GC_java_finalization = 1;
+#endif
tc16_guardian = scm_make_smob_type ("guardian", 0);