-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003 Free Software Foundation, Inc.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307 USA
- *
- * As a special exception, the Free Software Foundation gives permission
- * for additional uses of the text contained in its release of GUILE.
- *
- * The exception is that, if you link the GUILE library with other files
- * to produce an executable, this does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * Your use of that executable is in no way restricted on account of
- * linking the GUILE library code into it.
- *
- * This exception does not however invalidate any other reasons why
- * the executable file might be covered by the GNU General Public License.
- *
- * This exception applies only to the code released by the
- * Free Software Foundation under the name GUILE. If you copy
- * code from other Free Software Foundation releases into a copy of
- * GUILE, as the General Public License permits, the exception does
- * not apply to the code that you add in this way. To avoid misleading
- * anyone as to the status of such modified files, you must delete
- * this exception notice from them.
- *
- * If you write modifications of your own for GUILE, it is your choice
- * whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice. */
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
\f
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <stdio.h>
#include <errno.h>
#include <string.h>
scm_i_clear_mark_space ();
-#ifndef USE_THREADS
-
- /* Mark objects on the C stack. */
- SCM_FLUSH_REGISTER_WINDOWS;
- /* This assumes that all registers are saved into the jmp_buf */
- setjmp (scm_save_regs_gc_mark);
- scm_mark_locations ((SCM_STACKITEM *) scm_save_regs_gc_mark,
- ( (size_t) (sizeof (SCM_STACKITEM) - 1 +
- sizeof scm_save_regs_gc_mark)
- / sizeof (SCM_STACKITEM)));
-
- {
- unsigned long stack_len = scm_stack_size (scm_stack_base);
-#ifdef SCM_STACK_GROWS_UP
- scm_mark_locations (scm_stack_base, stack_len);
-#else
- scm_mark_locations (scm_stack_base - stack_len, stack_len);
-#endif
- }
- SCM_MARK_BACKING_STORE();
-
-#else /* USE_THREADS */
-
/* Mark every thread's stack and registers */
scm_threads_mark_stacks ();
-#endif /* USE_THREADS */
-
j = SCM_NUM_PROTECTS;
while (j--)
scm_gc_mark (scm_sys_protects[j]);
/* mark the registered roots */
{
size_t i;
- for (i = 0; i < SCM_VECTOR_LENGTH (scm_gc_registered_roots); ++i)
+ for (i = 0; i < SCM_HASHTABLE_N_BUCKETS (scm_gc_registered_roots); ++i)
{
- SCM l = SCM_VELTS (scm_gc_registered_roots)[i];
+ SCM l = SCM_HASHTABLE_BUCKETS (scm_gc_registered_roots)[i];
for (; !SCM_NULLP (l); l = SCM_CDR (l))
{
SCM *p = (SCM *) (scm_num2long (SCM_CAAR (l), 0, NULL));
* in different phases of GC
*/
scm_mark_subr_table ();
-
-
-#ifndef USE_THREADS
- scm_gc_mark (scm_root->handle);
-#endif
}
/* {Mark/Sweep}
scm_gc_mark (SCM ptr)
{
if (SCM_IMP (ptr))
- return ;
+ return;
if (SCM_GC_MARK_P (ptr))
- {
- return;
- }
+ return;
SCM_SET_GC_MARK (ptr);
scm_gc_mark_dependencies (ptr);
goto gc_mark_loop;
}
#endif
-#ifdef HAVE_ARRAYS
+#if SCM_HAVE_ARRAYS
case scm_tc7_bvect:
case scm_tc7_byvect:
case scm_tc7_ivect:
case scm_tc7_dvect:
case scm_tc7_cvect:
case scm_tc7_svect:
-#ifdef HAVE_LONG_LONGS
+#if SCM_SIZEOF_LONG_LONG != 0
case scm_tc7_llvect:
#endif
#endif
int weak_values;
len = SCM_VECTOR_LENGTH (ptr);
- weak_keys = SCM_IS_WHVEC (ptr) || SCM_IS_WHVEC_B (ptr);
- weak_values = SCM_IS_WHVEC_V (ptr) || SCM_IS_WHVEC_B (ptr);
+ weak_keys = SCM_WVECT_WEAK_KEY_P (ptr);
+ weak_values = SCM_WVECT_WEAK_VALUE_P (ptr);
for (x = 0; x < len; ++x)
{
i = SCM_PTOBNUM (ptr);
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (!(i < scm_numptob))
- SCM_MISC_ERROR ("undefined port type", SCM_EOL);
+ {
+ fprintf (stderr, "undefined port type");
+ abort();
+ }
#endif
if (SCM_PTAB_ENTRY(ptr))
scm_gc_mark (SCM_FILENAME (ptr));
i = SCM_SMOBNUM (ptr);
#if (SCM_DEBUG_CELL_ACCESSES == 1)
if (!(i < scm_numsmob))
- SCM_MISC_ERROR ("undefined smob type", SCM_EOL);
+ {
+ fprintf (stderr, "undefined smob type");
+ abort();
+ }
#endif
if (scm_smobs[i].mark)
{
}
break;
default:
- SCM_MISC_ERROR ("unknown type", SCM_EOL);
+ fprintf (stderr, "unknown type");
+ abort();
}
/*
#endif
if (!valid_cell)
- SCM_MISC_ERROR ("rogue pointer in heap", SCM_EOL);
+ {
+ fprintf (stderr, "rogue pointer in heap");
+ abort();
+ }
}
if (SCM_GC_MARK_P (ptr))