/* 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
+ */
/* #define DEBUGINFO */
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
-#else
-/*
- Provide a stub, so people can use their Scheme code on non-debug
- versions of GUILE as well.
- */
-SCM_DEFINE (scm_set_debug_cell_accesses_x, "set-debug-cell-accesses!", 1, 0, 0,
- (SCM flag),
- "This function is used to turn on checking for a debug version of GUILE. This version does not support this functionality\n")
-#define FUNC_NAME s_scm_set_debug_cell_accesses_x
-{
-
- /*
- do nothing
- */
- fprintf (stderr, "\nWARNING: GUILE was not compiled with SCM_DEBUG_CELL_ACCESSES");
- scm_remember_upto_here (flag);
- return SCM_UNSPECIFIED;
-}
-#undef FUNC_NAME
#endif /* SCM_DEBUG_CELL_ACCESSES == 1 */
double scm_gc_cells_swept_acc = 0.;
int scm_gc_cell_yield_percentage =0;
int scm_gc_malloc_yield_percentage = 0;
+unsigned long protected_obj_count = 0;
SCM_SYMBOL (sym_cells_allocated, "cells-allocated");
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");
unsigned long int local_scm_gc_time_taken;
unsigned long int local_scm_gc_times;
unsigned long int local_scm_gc_mark_time_taken;
+ unsigned long int local_protected_obj_count;
double local_scm_gc_cells_swept;
double local_scm_gc_cells_marked;
SCM answer;
local_scm_gc_times = scm_gc_times;
local_scm_gc_malloc_yield_percentage = scm_gc_malloc_yield_percentage;
local_scm_gc_cell_yield_percentage= scm_gc_cell_yield_percentage;
-
+ local_protected_obj_count = protected_obj_count;
local_scm_gc_cells_swept =
(double) scm_gc_cells_swept_acc
+ (double) scm_gc_cells_swept;
scm_cons (sym_cells_marked, scm_i_dbl2big (local_scm_gc_cells_marked)),
scm_cons (sym_cells_swept, scm_i_dbl2big (local_scm_gc_cells_swept)),
scm_cons (sym_malloc_yield, scm_long2num (local_scm_gc_malloc_yield_percentage)),
- scm_cons (sym_cell_yield, scm_long2num (local_scm_gc_cell_yield_percentage)),
+ scm_cons (sym_cell_yield, scm_long2num (local_scm_gc_cell_yield_percentage)),
+ scm_cons (sym_protected_objects, scm_ulong2num (local_protected_obj_count)),
scm_cons (sym_heap_segments, heap_segs),
SCM_UNDEFINED);
SCM_ALLOW_INTS;
* scm_remember_upto_here_1 (str); // str will be alive up to this point.
*/
+/* Remove any macro versions of these while defining the functions.
+ Functions are always included in the library, for upward binary
+ compatibility and in case combinations of GCC and non-GCC are used. */
+#undef scm_remember_upto_here_1
+#undef scm_remember_upto_here_2
+
void
scm_remember_upto_here_1 (SCM obj SCM_UNUSED)
{
scm_gc_protect_object(X) increments and scm_gc_unprotect_object(X) decrements.
*/
+
+
SCM
scm_gc_protect_object (SCM obj)
{
handle = scm_hashq_create_handle_x (scm_protects, obj, SCM_MAKINUM (0));
SCM_SETCDR (handle, scm_sum (SCM_CDR (handle), SCM_MAKINUM (1)));
+ protected_obj_count ++;
+
SCM_REALLOW_INTS;
return obj;
else
SCM_SETCDR (handle, count);
}
+ protected_obj_count --;
SCM_REALLOW_INTS;