}
static int scm_debug_check_freelist = 0;
+
+SCM_PROC (s_gc_set_debug_check_freelist_x, "gc-set-debug-check-freelist!", 1, 0, 0, scm_gc_set_debug_check_freelist_x);
+SCM
+scm_gc_set_debug_check_freelist_x (SCM flag)
+{
+ SCM_ASSERT(SCM_BOOL_T == flag || SCM_BOOL_F == flag,
+ flag, 1, s_gc_set_debug_check_freelist_x);
+ scm_debug_check_freelist = (SCM_BOOL_T==flag)? 1: 0;
+ return SCM_UNSPECIFIED;
+}
+
+
SCM
scm_debug_newcell (void)
{
SCM new;
scm_newcell_count++;
- if (scm_debug_check_freelist)
+ if (scm_debug_check_freelist) {
scm_check_freelist ();
+ scm_gc();
+ }
/* The rest of this is supposed to be identical to the SCM_NEWCELL
macro. */
extern unsigned long scm_mtrigger;
#ifdef DEBUG_FREELIST
+extern SCM scm_map_free_list (void);
extern SCM scm_debug_newcell (void);
+extern SCM scm_gc_set_debug_check_freelist_x (SCM flag);
#endif
\f
#ifdef DEBUG_FREELIST
-#define SCM_NEWCELL(_into) (_into = scm_debug_newcell ())
+#define SCM_NEWCELL(_into) do { _into = scm_debug_newcell (); } while (0)
#else
#define SCM_NEWCELL(_into) \
- { \
+ do { \
if (SCM_IMP(scm_freelist)) \
_into = scm_gc_for_newcell();\
else \
scm_freelist = SCM_CDR(scm_freelist);\
++scm_cells_allocated; \
} \
- }
+ } while(0)
#endif
\f
#undef DEBUG_EXTENSIONS
#undef READER_EXTENSIONS
+/* Define this if you want to debug the free list (helps w/ GC bugs) */
+#undef DEBUG_FREELIST
+
/* Define this if your system defines S_ISLNK in sys/stat.h */
#undef HAVE_S_ISLNK
SCM args;
{
int n, maxp, size;
- scm_debug_frame *dframe;
+ scm_debug_frame *dframe = scm_last_debug_frame;
scm_info_frame *iframe;
long offset = 0;
SCM stack, id;
/* Extract a pointer to the innermost frame of whatever object
scm_make_stack was given. */
- if (obj == SCM_BOOL_T)
- dframe = scm_last_debug_frame;
- else
+ /* just use dframe == scm_last_debug_frame
+ (from initialization of dframe, above) if obj is #t */
+ if (obj != SCM_BOOL_T)
{
SCM_ASSERT (SCM_NIMP (obj), obj, SCM_ARG1, s_make_stack);
if (SCM_DEBUGOBJP (obj))