faster GC traversal of shared closure prefixes

This commit is contained in:
Matthew Flatt 2015-11-28 11:21:19 -07:00
parent 89807d178e
commit 9407afa0a2

View File

@ -48,45 +48,49 @@
pf->fixup_chain = (Scheme_Object *)c;
} else {
/* Mark the prefix as reached in incremental mode, which
triggers special handling for bakpointers */
triggers special handling for backpointers */
SCHEME_PREFIX_FLAGS(pf) |= 0x1;
}
/* Mark just the elements of the prefix that are (newly) used: */
if ((uintptr_t)data->tl_map & 0x1) {
map = ((uintptr_t)data->tl_map) >> 1;
for (i = 0; i < 31; i++) {
if (map & (1 << i)) {
if (!(use_bits[0] & (1 << i))) {
if ((i < pf->num_toplevels) || !pf->num_stxes)
gcMARK2(pf->a[i], gc); /* top level */
else if (i == pf->num_toplevels)
mark_stxes = 1; /* any syntax object */
else
gcMARK2(pf->a[i + pf->num_stxes], gc); /* lifted */
map = (((uintptr_t)data->tl_map) >> 1) & 0x7FFFFFFF;
if ((use_bits[0] & map) != map) {
for (i = 0; i < 31; i++) {
if (map & (1 << i)) {
if (!(use_bits[0] & (1 << i))) {
if ((i < pf->num_toplevels) || !pf->num_stxes)
gcMARK2(pf->a[i], gc); /* top level */
else if (i == pf->num_toplevels)
mark_stxes = 1; /* any syntax object */
else
gcMARK2(pf->a[i + pf->num_stxes], gc); /* lifted */
}
}
}
use_bits[0] |= map;
}
use_bits[0] |= (map & 0x7FFFFFFF);
} else {
int *u = (int *)GC_resolve2(data->tl_map, gc), j, pos;
for (i = u[0]; i--; ) {
map = u[i+1];
for (j = 0; j < 32; j++) {
if (map & (1 << j)) {
if (!(use_bits[i] & (1 << j))) {
pos = (i * 32) + j;
if ((pos < pf->num_toplevels) || !pf->num_stxes)
gcMARK2(pf->a[pos], gc); /* top level */
else if (pos == pf->num_toplevels)
mark_stxes = 1; /* any syntax object */
else
gcMARK2(pf->a[pos + pf->num_stxes], gc); /* lifted */
if ((use_bits[i] & map) != map) {
for (j = 0; j < 32; j++) {
if (map & (1 << j)) {
if (!(use_bits[i] & (1 << j))) {
pos = (i * 32) + j;
if ((pos < pf->num_toplevels) || !pf->num_stxes)
gcMARK2(pf->a[pos], gc); /* top level */
else if (pos == pf->num_toplevels)
mark_stxes = 1; /* any syntax object */
else
gcMARK2(pf->a[pos + pf->num_stxes], gc); /* lifted */
}
}
}
use_bits[i] |= map;
}
use_bits[i] |= map;
}
}
if (mark_stxes) {