*/
int scm_i_cell_validation_already_running ;
-static SCM protects;
+/* Hash table that keeps a reference to objects the user wants to protect from
+ garbage collection. It could arguably be private but applications have come
+ to rely on it (e.g., Lilypond 2.13.9). */
+SCM scm_protects;
#if (SCM_DEBUG_CELL_ACCESSES == 1)
critsec/mutex inconsistency here. */
SCM_CRITICAL_SECTION_START;
- handle = scm_hashq_create_handle_x (protects, obj, scm_from_int (0));
+ handle = scm_hashq_create_handle_x (scm_protects, obj, scm_from_int (0));
SCM_SETCDR (handle, scm_sum (SCM_CDR (handle), scm_from_int (1)));
protected_obj_count ++;
abort ();
}
- handle = scm_hashq_get_handle (protects, obj);
+ handle = scm_hashq_get_handle (scm_protects, obj);
if (scm_is_false (handle))
{
{
SCM count = scm_difference (SCM_CDR (handle), scm_from_int (1));
if (scm_is_eq (count, scm_from_int (0)))
- scm_hashq_remove_x (protects, obj);
+ scm_hashq_remove_x (scm_protects, obj);
else
SCM_SETCDR (handle, count);
}
/* GC_REGISTER_DISPLACEMENT (scm_tc3_unused); */
/* Sanity check. */
- if (!GC_is_visible (&protects))
+ if (!GC_is_visible (&scm_protects))
abort ();
scm_c_hook_init (&scm_before_gc_c_hook, 0, SCM_C_HOOK_NORMAL);
void
scm_init_gc_protect_object ()
{
- protects = scm_c_make_hash_table (31);
+ scm_protects = scm_c_make_hash_table (31);
#if 0
/* We can't have a cleanup handler since we have no thread to run it
#ifndef SCM_GC_H
#define SCM_GC_H
-/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 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 License
SCM_API void scm_gc_unregister_root (SCM *p);
SCM_API void scm_gc_register_roots (SCM *b, unsigned long n);
SCM_API void scm_gc_unregister_roots (SCM *b, unsigned long n);
+SCM_API SCM scm_protects;
SCM_INTERNAL void scm_storage_prehistory (void);
SCM_INTERNAL void scm_init_gc_protect_object (void);
SCM_INTERNAL void scm_init_gc (void);