Revert previous changed

noticed an intermittent crash running read1
This commit is contained in:
Justin Ethier 2018-08-06 14:48:37 -04:00
parent 219cdf2d66
commit 386e208eb8

11
gc.c
View file

@ -541,7 +541,7 @@ size_t gc_convert_heap_page_to_free_list(gc_heap *h, gc_thread_data *thd)
gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
{
short heap_is_empty;
object p, end;
object p;
gc_free_list *q, *r, *s;
#if GC_DEBUG_SHOW_SWEEP_DIAG
gc_heap *orig_heap_ptr = h;
@ -567,15 +567,14 @@ gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
size_t remaining = h->size - (h->size % h->block_size); // - h->block_size; // Remove first one??
char *data_end = h->data + remaining;
heap_is_empty = 1; // Base case is an empty heap
end = (object)data_end;
p = h->data;
q = h->free_list;
while (p < end) {
while (remaining) {
p = data_end - remaining;
// find preceding/succeeding free list pointers for p
for (r = (q?q->next:NULL); r && ((char *)r < (char *)p); q = r, r = r->next) ;
if ((char *)q == (char *)p || (char *)r == (char *)p) { // this is a free block, skip it
//printf("Sweep skip free block %p remaining=%lu\n", p, remaining);
p = (object) (((char *)p) + h->block_size);
remaining -= h->block_size;
continue;
}
#if GC_SAFETY_CHECKS
@ -649,7 +648,7 @@ gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
}
//next->next = (gc_free_list *)(((char *) next) + h->block_size);
//next = next->next;
p = (object) (((char *)p) + h->block_size);
remaining -= h->block_size;
}
}
// Free the heap page if possible.