-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2009 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
\f
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <unistd.h>
#endif
+int scm_i_marking = 0;
+
/*
Entry point for this file.
*/
scm_i_init_guardians_for_gc ();
scm_i_clear_mark_space ();
-
+ scm_i_find_heap_calls = 0;
/* Mark every thread's stack and registers */
scm_threads_mark_stacks ();
}
}
}
-
- scm_mark_subr_table ();
loops = 0;
while (1)
if (SCM_GC_MARK_P (ptr))
return;
+ if (!scm_i_marking)
+ {
+ static const char msg[]
+ = "Should only call scm_gc_mark() during GC.";
+ scm_c_issue_deprecation_warning (msg);
+ }
+
SCM_SET_GC_MARK (ptr);
scm_gc_mark_dependencies (ptr);
}
void
-ensure_marking (void)
+scm_i_ensure_marking (void)
{
assert (scm_i_marking);
}
Should prefetch objects before marking, i.e. if marking a cell, we
should prefetch the car, and then mark the cdr. This will improve CPU
-cache misses, because the car is more likely to be in core when we
+cache misses, because the car is more likely to be in cache when we
finish the cdr.
See http://www.hpl.hp.com/techreports/2000/HPL-2000-99.pdf, reducing
}
ptr = SCM_SIMPLE_VECTOR_REF (ptr, 0);
goto gc_mark_loop;
-#ifdef CCLO
- case scm_tc7_cclo:
- {
- size_t i = SCM_CCLO_LENGTH (ptr);
- size_t j;
- for (j = 1; j != i; ++j)
- {
- SCM obj = SCM_CCLO_REF (ptr, j);
- if (!SCM_IMP (obj))
- scm_gc_mark (obj);
- }
- ptr = SCM_CCLO_REF (ptr, 0);
- goto gc_mark_loop;
- }
-#endif
case scm_tc7_string:
ptr = scm_i_string_mark (ptr);
ptr = SCM_CELL_OBJECT_1 (ptr);
goto gc_mark_loop;
case scm_tcs_subrs:
- break;
+ if (SCM_CELL_WORD_2 (ptr) && *(SCM*)SCM_CELL_WORD_2 (ptr))
+ /* the generic associated with this primitive */
+ scm_gc_mark (*(SCM*)SCM_CELL_WORD_2 (ptr));
+ if (SCM_NIMP (((SCM*)SCM_CELL_WORD_3 (ptr))[1]))
+ scm_gc_mark (((SCM*)SCM_CELL_WORD_3 (ptr))[1]); /* props */
+ ptr = ((SCM*)SCM_CELL_WORD_3 (ptr))[0]; /* name */
+ goto gc_mark_loop;
case scm_tc7_port:
i = SCM_PTOBNUM (ptr);
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (!(i < scm_numptob))
{
fprintf (stderr, "undefined port type");
- abort();
+ abort ();
}
#endif
- if (SCM_PTAB_ENTRY(ptr))
+ if (SCM_PTAB_ENTRY (ptr))
scm_gc_mark (SCM_FILENAME (ptr));
if (scm_ptobs[i].mark)
{
if (!(i < scm_numsmob))
{
fprintf (stderr, "undefined smob type");
- abort();
+ abort ();
}
#endif
if (scm_smobs[i].mark)
break;
default:
fprintf (stderr, "unknown type");
- abort();
+ abort ();
}
/*
{
/* We are in debug mode. Check the ptr exhaustively. */
- valid_cell = valid_cell && (scm_i_find_heap_segment_containing_object (ptr) >= 0);
+ valid_cell = valid_cell && scm_in_heap_p (ptr);
}
#endif
if (!valid_cell)
{
fprintf (stderr, "rogue pointer in heap");
- abort();
+ abort ();
}
}
- if (SCM_GC_MARK_P (ptr))
- {
+ if (SCM_GC_MARK_P (ptr))
return;
- }
SCM_SET_GC_MARK (ptr);
#undef FUNC_NAME
-
-
/* Mark a region conservatively */
void
scm_mark_locations (SCM_STACKITEM x[], unsigned long n)
void
-scm_gc_init_mark(void)
+scm_gc_init_mark (void)
{
#if SCM_ENABLE_DEPRECATED == 1
scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0);