* weaks.c (scm_make_weak_vector): Add another extra slot before
vector contents, to be used only during garbage collection.
* weaks.h (SCM_WVECT_GC_CHAIN): New macro to access it.
* gc.c (scm_weak_vectors): Now a SCM instead of a SCM*, and now
static.
(scm_weak_size, scm_n_weak): Deleted.
(scm_igc): Use SCM_WVECT_GC_CHAIN to build up a chain of weak
vectors without allocating new storage during GC, using
scm_weak_vectors as the head of the chain.
(scm_mark_weak_vector_spines): Walk SCM_WVECT_GC_CHAIN chain
instead of stepping through an array.
(scm_gc_sweep): Update offset used to find start of weak vector to
free it.
(scm_init_storage): Set scm_weak_vectors to EOL.
SCM fill;
{
SCM v;
- v = scm_make_vector (scm_sum (k, SCM_MAKINUM (1)), fill);
+ v = scm_make_vector (scm_sum (k, SCM_MAKINUM (2)), fill);
SCM_DEFER_INTS;
SCM_SETLENGTH(v, SCM_INUM (k), scm_tc7_wvect);
- SCM_VELTS(v)[0] = (SCM)0;
- SCM_SETVELTS(v, SCM_VELTS(v) + 1);
+ SCM_VELTS(v)[0] = SCM_EOL;
+ SCM_VELTS(v)[1] = (SCM)0;
+ SCM_SETVELTS(v, SCM_VELTS(v) + 2);
SCM_ALLOW_INTS;
return v;
}
#define SCM_IS_WHVEC_V(X) (SCM_VELTS(X)[-1] == 2)
#define SCM_IS_WHVEC_B(X) (SCM_VELTS(X)[-1] == 3)
#define SCM_IS_WHVEC_ANY(X) (SCM_VELTS(X)[-1])
+#define SCM_WVECT_GC_CHAIN(X) (SCM_VELTS(X)[-2])
\f