-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define _GNU_SOURCE
-
/* #define DEBUGINFO */
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
*/
if (scm_expensive_debug_cell_accesses_p)
scm_i_expensive_validation_check (cell);
-
+#if (SCM_DEBUG_MARKING_API == 0)
if (!SCM_GC_MARK_P (cell))
{
fprintf (stderr,
(unsigned long) SCM_UNPACK (cell));
abort ();
}
-
+#endif /* SCM_DEBUG_MARKING_API */
+
scm_i_cell_validation_already_running = 0; /* re-enable */
}
}
/* GC Statistics Keeping
*/
-unsigned long scm_cells_allocated = 0;
unsigned long scm_mallocated = 0;
-unsigned long scm_gc_cells_collected;
-unsigned long scm_gc_cells_collected_1 = 0; /* previous GC yield */
-unsigned long scm_gc_malloc_collected;
-unsigned long scm_gc_ports_collected;
-unsigned long scm_gc_time_taken = 0;
-static unsigned long t_before_gc;
-unsigned long scm_gc_mark_time_taken = 0;
-unsigned long scm_gc_times = 0;
-unsigned long scm_gc_cells_swept = 0;
-double scm_gc_cells_marked_acc = 0.;
-double scm_gc_cells_swept_acc = 0.;
-int scm_gc_cell_yield_percentage =0;
-int scm_gc_malloc_yield_percentage = 0;
+unsigned long scm_gc_ports_collected = 0;
+
static unsigned long protected_obj_count = 0;
SCM_SYMBOL (sym_gc_mark_time_taken, "gc-mark-time-taken");
SCM_SYMBOL (sym_times, "gc-times");
SCM_SYMBOL (sym_cells_marked, "cells-marked");
+SCM_SYMBOL (sym_cells_marked_conservatively, "cells-marked-conservatively");
SCM_SYMBOL (sym_cells_swept, "cells-swept");
SCM_SYMBOL (sym_malloc_yield, "malloc-yield");
SCM_SYMBOL (sym_cell_yield, "cell-yield");
SCM_SYMBOL (sym_protected_objects, "protected-objects");
-
-
+SCM_SYMBOL (sym_total_cells_allocated, "total-cells-allocated");
/* Number of calls to SCM_NEWCELL since startup. */
scm_cons (sym_cells_swept,
scm_from_double (local_scm_gc_cells_swept)),
scm_cons (sym_malloc_yield,
- scm_from_long(local_scm_gc_malloc_yield_percentage)),
+ scm_from_long (local_scm_gc_malloc_yield_percentage)),
scm_cons (sym_cell_yield,
scm_from_long (local_scm_gc_cell_yield_percentage)),
scm_cons (sym_heap_segments, heap_segs),
#undef FUNC_NAME
+SCM_DEFINE (scm_gc_dump, "gc-dump", 0, 0, 0,
+ (void),
+ "Dump information about the garbage collector's internal data "
+ "structures and memory usage to the standard output.")
+#define FUNC_NAME s_scm_gc_dump
+{
+ GC_dump ();
+
+ return SCM_UNSPECIFIED;
+}
+#undef FUNC_NAME
SCM_DEFINE (scm_object_address, "object-address", 1, 0, 0,
#define FUNC_NAME s_scm_gc
{
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
- scm_gc_running_p = 1;
scm_i_gc ("call");
/* njrev: It looks as though other places, e.g. scm_realloc,
can call scm_i_gc without acquiring the sweep mutex. Does this
(e.g. scm_permobjs above in scm_gc_stats) by a critical section,
not by the sweep mutex. Shouldn't all the GC-relevant objects be
protected in the same way? */
- scm_gc_running_p = 0;
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
scm_c_hook_run (&scm_after_gc_c_hook, 0);
return SCM_UNSPECIFIED;
*/
/* Implementation note: For every object X, there is a counter which
- scm_gc_protect_object(X) increments and scm_gc_unprotect_object(X) decrements.
+ scm_gc_protect_object (X) increments and scm_gc_unprotect_object (X) decrements.
*/
scm_storage_prehistory ()
{
GC_all_interior_pointers = 0;
+ GC_set_free_space_divisor (scm_getenv_int ("GC_FREE_SPACE_DIVISOR", 3));
GC_INIT ();
-#ifdef SCM_I_GSC_USE_PTHREAD_THREADS
+#if (! ((defined GC_VERSION_MAJOR) && (GC_VERSION_MAJOR >= 7))) \
+ && (defined 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 ();
*/
static void *
mark_gc_async (void * hook_data SCM_UNUSED,
- void *func_data SCM_UNUSED,
+ void *fn_data SCM_UNUSED,
void *data SCM_UNUSED)
{
/* If cell access debugging is enabled, the user may choose to perform