diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-11-08 20:39:38 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-11-08 20:39:38 -0800 |
commit | 0512605daf81ebcd9595fff447bc397825342a37 (patch) | |
tree | c3de299b609d808c28c6a378515f8f448c2d4d84 /gc.c | |
parent | 05243452efd861e872a6d5c612c23a2cdea86ec5 (diff) | |
download | txr-0512605daf81ebcd9595fff447bc397825342a37.tar.gz txr-0512605daf81ebcd9595fff447bc397825342a37.tar.bz2 txr-0512605daf81ebcd9595fff447bc397825342a37.zip |
gc: recalculate heap bounding box when sweeping.
Since sweep can delete heaps now, it's possible that the
bounding box may be tightened. Since we are iterating over all
heaps, we can just recalculate it.
* gc.c (sweep): Recalculate the heap boundaries using local
variables, taking care to exclude any heap that is being
deleted. Then update the globals.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -608,6 +608,7 @@ static int_ptr_t sweep(void) { int_ptr_t free_count = 0; heap_t **pph; + val hminb = nil, hmaxb = nil; #if HAVE_VALGRIND const int vg_dbg = opt_vg_debug; #endif @@ -683,10 +684,16 @@ static int_ptr_t sweep(void) } #endif } else { + if (!hmaxb || end > hmaxb) + hmaxb = end; + if (!hminb || heap->block < hminb) + hminb = heap->block; pph = &(*pph)->next; } } + heap_min_bound = hminb; + heap_max_bound = hmaxb; return free_count; } |