Chez Scheme: repair to code vs. non-code chunk handling

The daily build plot showed much higher peak memory use due to some
missing pieces for the split.
This commit is contained in:
Matthew Flatt 2020-11-29 06:03:04 -07:00
parent 1bf4086dae
commit 3085780849
3 changed files with 254 additions and 242 deletions

View File

@ -1651,7 +1651,7 @@ ptr GCENTRY(ptr tc, ptr count_roots_ls) {
si->forwarded_flonums = 0;
#endif
} else {
chunkinfo *chunk = si->chunk;
chunkinfo *chunk = si->chunk, **chunks = ((si->space == space_code) ? S_code_chunks : S_chunks);
S_G.number_of_nonstatic_segments -= 1;
S_G.number_of_empty_segments += 1;
si->space = space_empty;
@ -1666,10 +1666,10 @@ ptr GCENTRY(ptr tc, ptr count_roots_ls) {
* small stuff into them and thereby invite fragmentation */
S_free_chunk(chunk);
} else {
S_move_to_chunk_list(chunk, &S_chunks[PARTIAL_CHUNK_POOLS]);
S_move_to_chunk_list(chunk, &chunks[PARTIAL_CHUNK_POOLS]);
}
} else {
S_move_to_chunk_list(chunk, &S_chunks[PARTIAL_CHUNK_POOLS-1]);
S_move_to_chunk_list(chunk, &chunks[PARTIAL_CHUNK_POOLS-1]);
}
}
}

View File

@ -648,7 +648,7 @@ static void check_heap_dirty_msg(msg, x) char *msg; ptr *x; {
void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
uptr seg; INT d; ISPC s; IGEN g; IDIRTYBYTE dirty; IBOOL found_eos; IGEN pg;
ptr p, *pp1, *pp2, *nl;
iptr i;
iptr i, for_code;
uptr empty_segments = 0;
uptr used_segments = 0;
uptr static_segments = 0;
@ -673,8 +673,11 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
}
}
for (for_code = 0; for_code < 2; for_code++) {
for (i = PARTIAL_CHUNK_POOLS; i >= -1; i -= 1) {
chunkinfo *chunk = i == -1 ? S_chunks_full : S_chunks[i];
chunkinfo *chunk = (i == -1
? (for_code ? S_code_chunks_full : S_chunks_full)
: (for_code ? S_code_chunks[i] : S_chunks[i]));
while (chunk != NULL) {
seginfo *si = chunk->unused_segs;
iptr count = 0;
@ -696,6 +699,7 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
chunk = chunk->next;
}
}
}
for (s = 0; s <= max_real_space; s += 1) {
seginfo *si;
@ -734,8 +738,11 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
(ptrdiff_t)empty_segments);
}
for (for_code = 0; for_code < 2; for_code++) {
for (i = PARTIAL_CHUNK_POOLS; i >= -1; i -= 1) {
chunkinfo *chunk = i == -1 ? S_chunks_full : S_chunks[i];
chunkinfo *chunk = (i == -1
? (for_code ? S_code_chunks_full : S_chunks_full)
: (for_code ? S_code_chunks[i] : S_chunks[i]));
while (chunk != NULL) {
uptr nsegs; seginfo *si;
for (si = &chunk->sis[0], nsegs = chunk->segs; nsegs != 0; nsegs -= 1, si += 1) {
@ -1004,6 +1011,7 @@ void S_check_heap(aftergc, mcg) IBOOL aftergc; IGEN mcg; {
chunk = chunk->next;
}
}
}
{
for (g = 0; g <= S_G.max_nonstatic_generation; INCRGEN(g)) {

View File

@ -275,6 +275,10 @@ static ptr sorted_chunk_list(void) {
ls = Scons(TO_PTR(chunk), ls);
n += 1;
}
for (chunk = (i == -1) ? S_code_chunks_full : S_code_chunks[i]; chunk != NULL; chunk = chunk->next) {
ls = Scons(TO_PTR(chunk), ls);
n += 1;
}
}
return sort_chunks(ls, n);