1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 06:20:23 +02:00

Fix from Ken Raeburn <raeburn@raeburn.org>:

* 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.
This commit is contained in:
Jim Blandy 1999-06-15 14:00:11 +00:00
parent 70c4c075e3
commit 250da36910
2 changed files with 5 additions and 3 deletions

View file

@ -58,11 +58,12 @@ scm_make_weak_vector (k, fill)
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;
}

View file

@ -54,6 +54,7 @@
#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])