mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-04 05:50:26 +02:00
add SCM_HEAP_OBJECT_BASE
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM, returns a pointer to the start of its memory area on the heap. * libguile/bytevectors.c: * libguile/fluids.c: * libguile/foreign.c: * libguile/gc.h: * libguile/guardians.c: * libguile/numbers.h: * libguile/ports.c: * libguile/smob.c: * libguile/struct.c: * libguile/weak-set.c: * libguile/weak-table.c: * libguile/weak-vector.c: Use it.
This commit is contained in:
parent
449ca87bdb
commit
03daea184e
14 changed files with 54 additions and 36 deletions
|
@ -332,7 +332,8 @@ scm_c_shrink_bytevector (SCM bv, size_t c_new_len)
|
||||||
SCM_BYTEVECTOR_SET_LENGTH (bv, c_new_len);
|
SCM_BYTEVECTOR_SET_LENGTH (bv, c_new_len);
|
||||||
|
|
||||||
if (SCM_BYTEVECTOR_CONTIGUOUS_P (bv))
|
if (SCM_BYTEVECTOR_CONTIGUOUS_P (bv))
|
||||||
new_bv = PTR2SCM (scm_gc_realloc (SCM2PTR (bv),
|
new_bv = SCM_PACK_POINTER
|
||||||
|
(scm_gc_realloc (SCM_HEAP_OBJECT_BASE (bv),
|
||||||
c_len + SCM_BYTEVECTOR_HEADER_BYTES,
|
c_len + SCM_BYTEVECTOR_HEADER_BYTES,
|
||||||
c_new_len + SCM_BYTEVECTOR_HEADER_BYTES,
|
c_new_len + SCM_BYTEVECTOR_HEADER_BYTES,
|
||||||
SCM_GC_BYTEVECTOR));
|
SCM_GC_BYTEVECTOR));
|
||||||
|
|
|
@ -151,7 +151,7 @@ new_fluid (SCM init)
|
||||||
SCM_SET_CELL_WORD_0 (fluid, (scm_tc7_fluid | (n << 8)));
|
SCM_SET_CELL_WORD_0 (fluid, (scm_tc7_fluid | (n << 8)));
|
||||||
|
|
||||||
GC_GENERAL_REGISTER_DISAPPEARING_LINK (&allocated_fluids[n],
|
GC_GENERAL_REGISTER_DISAPPEARING_LINK (&allocated_fluids[n],
|
||||||
SCM2PTR (fluid));
|
SCM_HEAP_OBJECT_BASE (fluid));
|
||||||
|
|
||||||
scm_dynwind_end ();
|
scm_dynwind_end ();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -157,7 +157,8 @@ scm_from_pointer (void *ptr, scm_t_pointer_finalizer finalizer)
|
||||||
ret = scm_cell (scm_tc7_pointer, (scm_t_bits) ptr);
|
ret = scm_cell (scm_tc7_pointer, (scm_t_bits) ptr);
|
||||||
|
|
||||||
if (finalizer)
|
if (finalizer)
|
||||||
scm_i_set_finalizer (SCM2PTR (ret), pointer_finalizer_trampoline,
|
scm_i_set_finalizer (SCM_HEAP_OBJECT_BASE (ret),
|
||||||
|
pointer_finalizer_trampoline,
|
||||||
finalizer);
|
finalizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +312,7 @@ SCM_DEFINE (scm_set_pointer_finalizer_x, "set-pointer-finalizer!", 2, 0, 0,
|
||||||
SCM_VALIDATE_POINTER (1, pointer);
|
SCM_VALIDATE_POINTER (1, pointer);
|
||||||
SCM_VALIDATE_POINTER (2, finalizer);
|
SCM_VALIDATE_POINTER (2, finalizer);
|
||||||
|
|
||||||
scm_i_add_finalizer (SCM2PTR (pointer), pointer_finalizer_trampoline,
|
scm_i_add_finalizer (SCM_HEAP_OBJECT_BASE (pointer), pointer_finalizer_trampoline,
|
||||||
SCM_POINTER_VALUE (finalizer));
|
SCM_POINTER_VALUE (finalizer));
|
||||||
|
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
|
|
|
@ -46,12 +46,13 @@ typedef struct scm_t_cell
|
||||||
* in debug mode. In particular these macros will even work for free cells,
|
* in debug mode. In particular these macros will even work for free cells,
|
||||||
* which should never be encountered by user code. */
|
* which should never be encountered by user code. */
|
||||||
|
|
||||||
#define SCM_GC_CELL_OBJECT(x, n) (((SCM *)SCM2PTR (x)) [n])
|
#define SCM_GC_CELL_OBJECT(x, n) (SCM_PACK (SCM_HEAP_OBJECT_BASE (x)[n]))
|
||||||
#define SCM_GC_CELL_WORD(x, n) (SCM_UNPACK (SCM_GC_CELL_OBJECT ((x), (n))))
|
#define SCM_GC_CELL_WORD(x, n) (SCM_HEAP_OBJECT_BASE (x)[n])
|
||||||
|
|
||||||
#define SCM_GC_SET_CELL_OBJECT(x, n, v) ((((SCM *)SCM2PTR (x)) [n]) = (v))
|
#define SCM_GC_SET_CELL_OBJECT(x, n, v) \
|
||||||
|
(SCM_HEAP_OBJECT_BASE (x)[n] = SCM_UNPACK (v))
|
||||||
#define SCM_GC_SET_CELL_WORD(x, n, v) \
|
#define SCM_GC_SET_CELL_WORD(x, n, v) \
|
||||||
(SCM_GC_SET_CELL_OBJECT ((x), (n), SCM_PACK (v)))
|
(SCM_HEAP_OBJECT_BASE (x)[n] = (v))
|
||||||
|
|
||||||
#define SCM_GC_CELL_TYPE(x) (SCM_GC_CELL_OBJECT ((x), 0))
|
#define SCM_GC_CELL_TYPE(x) (SCM_GC_CELL_OBJECT ((x), 0))
|
||||||
|
|
||||||
|
@ -97,7 +98,8 @@ typedef struct scm_t_cell
|
||||||
#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT ((x), 2, (v))
|
#define SCM_SET_CELL_OBJECT_2(x, v) SCM_SET_CELL_OBJECT ((x), 2, (v))
|
||||||
#define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT ((x), 3, (v))
|
#define SCM_SET_CELL_OBJECT_3(x, v) SCM_SET_CELL_OBJECT ((x), 3, (v))
|
||||||
|
|
||||||
#define SCM_CELL_OBJECT_LOC(x, n) (SCM_VALIDATE_CELL((x), &SCM_GC_CELL_OBJECT ((x), (n))))
|
#define SCM_CELL_WORD_LOC(x, n) (SCM_VALIDATE_CELL((x), &SCM_GC_CELL_WORD ((x), (n))))
|
||||||
|
#define SCM_CELL_OBJECT_LOC(x, n) ((SCM *) SCM_CELL_WORD_LOC (x, n))
|
||||||
#define SCM_CARLOC(x) (SCM_CELL_OBJECT_LOC ((x), 0))
|
#define SCM_CARLOC(x) (SCM_CELL_OBJECT_LOC ((x), 0))
|
||||||
#define SCM_CDRLOC(x) (SCM_CELL_OBJECT_LOC ((x), 1))
|
#define SCM_CDRLOC(x) (SCM_CELL_OBJECT_LOC ((x), 1))
|
||||||
|
|
||||||
|
|
|
@ -219,6 +219,8 @@ scm_i_guard (SCM guardian, SCM obj)
|
||||||
SCM_EOL);
|
SCM_EOL);
|
||||||
finalizer_data = scm_cons (SCM_BOOL_F, guardians_for_obj);
|
finalizer_data = scm_cons (SCM_BOOL_F, guardians_for_obj);
|
||||||
|
|
||||||
|
/* FIXME: should be SCM_HEAP_OBJECT_BASE, but will the finalizer
|
||||||
|
strip the tag bits of pairs or structs? */
|
||||||
GC_REGISTER_FINALIZER_NO_ORDER (SCM_UNPACK_POINTER (obj), finalize_guarded,
|
GC_REGISTER_FINALIZER_NO_ORDER (SCM_UNPACK_POINTER (obj), finalize_guarded,
|
||||||
SCM_UNPACK_POINTER (finalizer_data),
|
SCM_UNPACK_POINTER (finalizer_data),
|
||||||
&prev_finalizer, &prev_data);
|
&prev_finalizer, &prev_data);
|
||||||
|
|
|
@ -103,7 +103,7 @@ SCM_DEFINE (scm_make_syntax_transformer, "make-syntax-transformer", 3, 0, 0,
|
||||||
SCM_VALIDATE_SYMBOL (2, type);
|
SCM_VALIDATE_SYMBOL (2, type);
|
||||||
|
|
||||||
z = scm_words (scm_tc16_macro, 5);
|
z = scm_words (scm_tc16_macro, 5);
|
||||||
SCM_SET_SMOB_DATA_N (z, 1, prim);
|
SCM_SET_SMOB_DATA_N (z, 1, (scm_t_bits)prim);
|
||||||
SCM_SET_SMOB_OBJECT_N (z, 2, name);
|
SCM_SET_SMOB_OBJECT_N (z, 2, name);
|
||||||
SCM_SET_SMOB_OBJECT_N (z, 3, type);
|
SCM_SET_SMOB_OBJECT_N (z, 3, type);
|
||||||
SCM_SET_SMOB_OBJECT_N (z, 4, binding);
|
SCM_SET_SMOB_OBJECT_N (z, 4, binding);
|
||||||
|
|
|
@ -128,9 +128,9 @@ typedef scm_t_int32 scm_t_wchar;
|
||||||
#define SCM_REALP(x) (SCM_HAS_TYP16 (x, scm_tc16_real))
|
#define SCM_REALP(x) (SCM_HAS_TYP16 (x, scm_tc16_real))
|
||||||
#define SCM_COMPLEXP(x) (SCM_HAS_TYP16 (x, scm_tc16_complex))
|
#define SCM_COMPLEXP(x) (SCM_HAS_TYP16 (x, scm_tc16_complex))
|
||||||
|
|
||||||
#define SCM_REAL_VALUE(x) (((scm_t_double *) SCM2PTR (x))->real)
|
#define SCM_REAL_VALUE(x) (((scm_t_double *) SCM_HEAP_OBJECT_BASE (x))->real)
|
||||||
#define SCM_COMPLEX_REAL(x) (((scm_t_complex *) SCM2PTR (x))->real)
|
#define SCM_COMPLEX_REAL(x) (((scm_t_complex *) SCM_HEAP_OBJECT_BASE (x))->real)
|
||||||
#define SCM_COMPLEX_IMAG(x) (((scm_t_complex *) SCM2PTR (x))->imag)
|
#define SCM_COMPLEX_IMAG(x) (((scm_t_complex *) SCM_HEAP_OBJECT_BASE (x))->imag)
|
||||||
|
|
||||||
/* Each bignum is just an mpz_t stored in a double cell starting at word 1. */
|
/* Each bignum is just an mpz_t stored in a double cell starting at word 1. */
|
||||||
#define SCM_I_BIG_MPZ(x) (*((mpz_t *) (SCM_CELL_OBJECT_LOC((x),1))))
|
#define SCM_I_BIG_MPZ(x) (*((mpz_t *) (SCM_CELL_OBJECT_LOC((x),1))))
|
||||||
|
|
|
@ -676,7 +676,7 @@ scm_c_make_port_with_encoding (scm_t_bits tag, unsigned long mode_bits,
|
||||||
entry->alist = SCM_EOL;
|
entry->alist = SCM_EOL;
|
||||||
|
|
||||||
if (SCM_PORT_DESCRIPTOR (ret)->free)
|
if (SCM_PORT_DESCRIPTOR (ret)->free)
|
||||||
scm_i_set_finalizer (SCM2PTR (ret), finalize_port, NULL);
|
scm_i_set_finalizer (SCM_HEAP_OBJECT_BASE (ret), finalize_port, NULL);
|
||||||
|
|
||||||
if (SCM_PORT_DESCRIPTOR (ret)->flags & SCM_PORT_TYPE_HAS_FLUSH)
|
if (SCM_PORT_DESCRIPTOR (ret)->flags & SCM_PORT_TYPE_HAS_FLUSH)
|
||||||
scm_weak_set_add_x (scm_i_port_weak_set, ret);
|
scm_weak_set_add_x (scm_i_port_weak_set, ret);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -414,7 +414,7 @@ scm_i_new_smob (scm_t_bits tc, scm_t_bits data)
|
||||||
SCM_SET_CELL_WORD_0 (ret, tc);
|
SCM_SET_CELL_WORD_0 (ret, tc);
|
||||||
|
|
||||||
if (scm_smobs[smobnum].free)
|
if (scm_smobs[smobnum].free)
|
||||||
scm_i_set_finalizer (SCM2PTR (ret), finalize_smob, NULL);
|
scm_i_set_finalizer (SCM_HEAP_OBJECT_BASE (ret), finalize_smob, NULL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ scm_i_new_double_smob (scm_t_bits tc, scm_t_bits data1,
|
||||||
SCM_SET_CELL_WORD_0 (ret, tc);
|
SCM_SET_CELL_WORD_0 (ret, tc);
|
||||||
|
|
||||||
if (scm_smobs[smobnum].free)
|
if (scm_smobs[smobnum].free)
|
||||||
scm_i_set_finalizer (SCM2PTR (ret), finalize_smob, NULL);
|
scm_i_set_finalizer (SCM_HEAP_OBJECT_BASE (ret), finalize_smob, NULL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 1996,1997,1998,1999,2000,2001, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -445,7 +445,8 @@ scm_i_alloc_struct (scm_t_bits *vtable_data, int n_words)
|
||||||
/* vtable_data can be null when making a vtable vtable */
|
/* vtable_data can be null when making a vtable vtable */
|
||||||
if (vtable_data && vtable_data[scm_vtable_index_instance_finalize])
|
if (vtable_data && vtable_data[scm_vtable_index_instance_finalize])
|
||||||
/* Register a finalizer for the newly created instance. */
|
/* Register a finalizer for the newly created instance. */
|
||||||
scm_i_set_finalizer (SCM2PTR (ret), struct_finalizer_trampoline, NULL);
|
scm_i_set_finalizer (SCM_HEAP_OBJECT_BASE (ret),
|
||||||
|
struct_finalizer_trampoline, NULL);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,6 +391,17 @@ typedef union SCM { struct { scm_t_bits n; } n; } SCM;
|
||||||
#define scm_tc3_tc7_2 7
|
#define scm_tc3_tc7_2 7
|
||||||
|
|
||||||
|
|
||||||
|
/* As we have seen, heap objects have a tag in their three lowest bits.
|
||||||
|
If you have a heap object and want the pointer to the start of the
|
||||||
|
object, perhaps for GC purposes, you need to mask off the low bits,
|
||||||
|
which is what SCM_HEAP_OBJECT_BASE does.
|
||||||
|
|
||||||
|
Note that you can avoid this macro if you know the specific type of
|
||||||
|
the object (pair, struct, or other).
|
||||||
|
*/
|
||||||
|
#define SCM_HEAP_OBJECT_BASE(x) ((scm_t_bits*)((SCM_UNPACK (x)) & ~7))
|
||||||
|
|
||||||
|
|
||||||
/* Definitions for tc7: */
|
/* Definitions for tc7: */
|
||||||
|
|
||||||
#define SCM_ITAG7(x) (127 & SCM_UNPACK (x))
|
#define SCM_ITAG7(x) (127 & SCM_UNPACK (x))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -580,7 +580,7 @@ weak_set_add_x (scm_t_weak_set *set, unsigned long hash,
|
||||||
|
|
||||||
if (SCM_HEAP_OBJECT_P (obj))
|
if (SCM_HEAP_OBJECT_P (obj))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entries[k].key,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entries[k].key,
|
||||||
(void *) SCM2PTR (obj));
|
(void *) SCM_HEAP_OBJECT_BASE (obj));
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -743,7 +743,7 @@ scm_c_register_weak_gc_callback (SCM obj, void (*callback) (SCM))
|
||||||
|
|
||||||
weak[0] = SCM_UNPACK_POINTER (obj);
|
weak[0] = SCM_UNPACK_POINTER (obj);
|
||||||
weak[1] = (void*)callback;
|
weak[1] = (void*)callback;
|
||||||
GC_GENERAL_REGISTER_DISAPPEARING_LINK (weak, SCM2PTR (obj));
|
GC_GENERAL_REGISTER_DISAPPEARING_LINK (weak, SCM_HEAP_OBJECT_BASE (obj));
|
||||||
|
|
||||||
#ifdef HAVE_GC_SET_START_CALLBACK
|
#ifdef HAVE_GC_SET_START_CALLBACK
|
||||||
scm_c_hook_add (&scm_after_gc_c_hook, weak_gc_hook, weak, 0);
|
scm_c_hook_add (&scm_after_gc_c_hook, weak_gc_hook, weak, 0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -131,13 +131,13 @@ register_disappearing_links (scm_t_weak_entry *entry,
|
||||||
&& (kind == SCM_WEAK_TABLE_KIND_KEY
|
&& (kind == SCM_WEAK_TABLE_KIND_KEY
|
||||||
|| kind == SCM_WEAK_TABLE_KIND_BOTH))
|
|| kind == SCM_WEAK_TABLE_KIND_BOTH))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entry->key,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entry->key,
|
||||||
SCM2PTR (k));
|
SCM_HEAP_OBJECT_BASE (k));
|
||||||
|
|
||||||
if (SCM_UNPACK (v) && SCM_HEAP_OBJECT_P (v)
|
if (SCM_UNPACK (v) && SCM_HEAP_OBJECT_P (v)
|
||||||
&& (kind == SCM_WEAK_TABLE_KIND_VALUE
|
&& (kind == SCM_WEAK_TABLE_KIND_VALUE
|
||||||
|| kind == SCM_WEAK_TABLE_KIND_BOTH))
|
|| kind == SCM_WEAK_TABLE_KIND_BOTH))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entry->value,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &entry->value,
|
||||||
SCM2PTR (v));
|
SCM_HEAP_OBJECT_BASE (v));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -162,7 +162,7 @@ move_disappearing_links (scm_t_weak_entry *from, scm_t_weak_entry *to,
|
||||||
GC_move_disappearing_link ((void **) &from->key, (void **) &to->key);
|
GC_move_disappearing_link ((void **) &from->key, (void **) &to->key);
|
||||||
#else
|
#else
|
||||||
GC_unregister_disappearing_link ((void **) &from->key);
|
GC_unregister_disappearing_link ((void **) &from->key);
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &to->key, SCM2PTR (key));
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &to->key, SCM_HEAP_OBJECT_BASE (key));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ move_disappearing_links (scm_t_weak_entry *from, scm_t_weak_entry *to,
|
||||||
GC_move_disappearing_link ((void **) &from->value, (void **) &to->value);
|
GC_move_disappearing_link ((void **) &from->value, (void **) &to->value);
|
||||||
#else
|
#else
|
||||||
GC_unregister_disappearing_link ((void **) &from->value);
|
GC_unregister_disappearing_link ((void **) &from->value);
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &to->value, SCM2PTR (value));
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &to->value, SCM_HEAP_OBJECT_BASE (value));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ mark_weak_key_table (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
|
||||||
if (entries[k].hash && entries[k].key)
|
if (entries[k].hash && entries[k].key)
|
||||||
{
|
{
|
||||||
SCM value = SCM_PACK (entries[k].value);
|
SCM value = SCM_PACK (entries[k].value);
|
||||||
mark_stack_ptr = GC_MARK_AND_PUSH ((GC_word*) SCM2PTR (value),
|
mark_stack_ptr = GC_MARK_AND_PUSH ((GC_word*) SCM_HEAP_OBJECT_BASE (value),
|
||||||
mark_stack_ptr, mark_stack_limit,
|
mark_stack_ptr, mark_stack_limit,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ mark_weak_value_table (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
|
||||||
if (entries[k].hash && entries[k].value)
|
if (entries[k].hash && entries[k].value)
|
||||||
{
|
{
|
||||||
SCM key = SCM_PACK (entries[k].key);
|
SCM key = SCM_PACK (entries[k].key);
|
||||||
mark_stack_ptr = GC_MARK_AND_PUSH ((GC_word*) SCM2PTR (key),
|
mark_stack_ptr = GC_MARK_AND_PUSH ((GC_word*) SCM_HEAP_OBJECT_BASE (key),
|
||||||
mark_stack_ptr, mark_stack_limit,
|
mark_stack_ptr, mark_stack_limit,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ scm_c_register_weak_gc_callback (SCM obj, void (*callback) (SCM))
|
||||||
|
|
||||||
weak[0] = SCM_UNPACK_POINTER (obj);
|
weak[0] = SCM_UNPACK_POINTER (obj);
|
||||||
weak[1] = (void*)callback;
|
weak[1] = (void*)callback;
|
||||||
GC_GENERAL_REGISTER_DISAPPEARING_LINK (weak, SCM2PTR (obj));
|
GC_GENERAL_REGISTER_DISAPPEARING_LINK (weak, SCM_HEAP_OBJECT_BASE (obj));
|
||||||
|
|
||||||
#ifdef HAVE_GC_TABLE_START_CALLBACK
|
#ifdef HAVE_GC_TABLE_START_CALLBACK
|
||||||
scm_c_hook_add (&scm_after_gc_c_hook, weak_gc_hook, weak, 0);
|
scm_c_hook_add (&scm_after_gc_c_hook, weak_gc_hook, weak, 0);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2006, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -177,7 +177,7 @@ scm_c_weak_vector_set_x (SCM wv, size_t k, SCM x)
|
||||||
|
|
||||||
if (SCM_HEAP_OBJECT_P (x))
|
if (SCM_HEAP_OBJECT_P (x))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &elts[k],
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &elts[k],
|
||||||
SCM2PTR (x));
|
SCM_HEAP_OBJECT_BASE (x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue