mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Remove dead code and clean up formatting
This commit is contained in:
parent
91c67aee8b
commit
37bd321245
1 changed files with 98 additions and 140 deletions
48
gc.c
48
gc.c
|
@ -555,7 +555,6 @@ gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
|
||||||
fprintf(stderr, "Heap %d diagnostics:\n", heap_type);
|
fprintf(stderr, "Heap %d diagnostics:\n", heap_type);
|
||||||
gc_print_stats(orig_heap_ptr);
|
gc_print_stats(orig_heap_ptr);
|
||||||
#endif
|
#endif
|
||||||
//for (; h; prev_h = h, h = h->next) { // All heaps
|
|
||||||
|
|
||||||
if (h->data_end != NULL) {
|
if (h->data_end != NULL) {
|
||||||
// Special case, bump&pop heap
|
// Special case, bump&pop heap
|
||||||
|
@ -650,43 +649,11 @@ gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
|
||||||
heap_is_empty = 0;
|
heap_is_empty = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ck_pr_add_ptr(&(thd->cached_heap_free_sizes[heap_type]), heap_freed);
|
|
||||||
// Free the heap page if possible.
|
// Free the heap page if possible.
|
||||||
//
|
|
||||||
// With huge heaps, this becomes more important. one of the huge
|
|
||||||
// pages only has one object, so it is likely that the page
|
|
||||||
// will become free at some point and could be reclaimed.
|
|
||||||
//
|
|
||||||
// The newly created flag is used to attempt to avoid situtaions
|
|
||||||
// where a page is allocated because there is not enough free space,
|
|
||||||
// but then we do a sweep and see it is empty so we free it, and
|
|
||||||
// so forth. A better solution might be to keep empty heap pages
|
|
||||||
// off to the side and only free them if there is enough free space
|
|
||||||
// remaining without them.
|
|
||||||
//
|
|
||||||
// Experimenting with only freeing huge heaps
|
|
||||||
|
|
||||||
//if (heap_is_empty) {
|
|
||||||
// printf("heap %d %p is empty\n", h->type, h);
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (heap_is_empty &&
|
if (heap_is_empty &&
|
||||||
(h->type == HEAP_HUGE || (h->ttl--) <= 0)) {
|
(h->type == HEAP_HUGE || (h->ttl--) <= 0)) {
|
||||||
rv = NULL; // Let caller know heap needs to be freed
|
rv = NULL; // Let caller know heap needs to be freed
|
||||||
}
|
}
|
||||||
// if (heap_is_empty && !(h->ttl--)) {
|
|
||||||
// unsigned int h_size = h->size;
|
|
||||||
// gc_heap *new_h = gc_heap_free(h, prev_h);
|
|
||||||
// if (new_h) { // Ensure free succeeded
|
|
||||||
// h = new_h;
|
|
||||||
// ck_pr_sub_ptr(&(thd->cached_heap_free_sizes[heap_type] ), h_size);
|
|
||||||
// thd->cached_heap_total_sizes[heap_type] -= h_size;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// sum_freed += heap_freed;
|
|
||||||
// heap_freed = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
#if GC_DEBUG_SHOW_SWEEP_DIAG
|
#if GC_DEBUG_SHOW_SWEEP_DIAG
|
||||||
fprintf(stderr, "\nAfter sweep -------------------------\n");
|
fprintf(stderr, "\nAfter sweep -------------------------\n");
|
||||||
|
@ -694,8 +661,6 @@ gc_heap *gc_sweep_fixed_size(gc_heap * h, int heap_type, gc_thread_data *thd)
|
||||||
gc_print_stats(orig_heap_ptr);
|
gc_print_stats(orig_heap_ptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// if (sum_freed_ptr)
|
|
||||||
// *sum_freed_ptr = sum_freed;
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,9 +696,7 @@ gc_heap *gc_heap_free(gc_heap *page, gc_heap *prev_page)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determine if a heap page is empty.
|
* @brief Determine if a heap page is empty.
|
||||||
* Note this only works for heaps that are not fixed-size.
|
* @param h Heap to inspect. The caller should acquire any necessary locks.
|
||||||
* @param h Heap to inspect. The caller should acquire the necessary lock
|
|
||||||
* on this heap.
|
|
||||||
* @return A truthy value if the heap is empty, 0 otherwise.
|
* @return A truthy value if the heap is empty, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int gc_is_heap_empty(gc_heap *h)
|
int gc_is_heap_empty(gc_heap *h)
|
||||||
|
@ -741,7 +704,7 @@ int gc_is_heap_empty(gc_heap *h)
|
||||||
gc_free_list *f;
|
gc_free_list *f;
|
||||||
if (!h) return 0;
|
if (!h) return 0;
|
||||||
|
|
||||||
if (h->data_end) { // Bump&pop
|
if (h->data_end) { // Fixed-size bump&pop
|
||||||
return (h->remaining == (h->size - (h->size % h->block_size)));
|
return (h->remaining == (h->size - (h->size % h->block_size)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2502,12 +2465,7 @@ void gc_collector()
|
||||||
//clear :
|
//clear :
|
||||||
ck_pr_cas_int(&gc_stage, STAGE_RESTING, STAGE_CLEAR_OR_MARKING);
|
ck_pr_cas_int(&gc_stage, STAGE_RESTING, STAGE_CLEAR_OR_MARKING);
|
||||||
// exchange values of markColor and clearColor
|
// exchange values of markColor and clearColor
|
||||||
// old_clear = ck_pr_load_8(&gc_color_clear);
|
//
|
||||||
// old_mark = ck_pr_load_8(&gc_color_mark);
|
|
||||||
// while (!ck_pr_cas_8(&gc_color_clear, old_clear, old_mark)) {
|
|
||||||
// }
|
|
||||||
// while (!ck_pr_cas_8(&gc_color_mark, old_mark, old_clear)) {
|
|
||||||
// }
|
|
||||||
// We now increment both so that clear becomes the old mark color and a
|
// We now increment both so that clear becomes the old mark color and a
|
||||||
// new value is used for the mark color. The old clear color becomes
|
// new value is used for the mark color. The old clear color becomes
|
||||||
// purple, indicating any of these objects are garbage
|
// purple, indicating any of these objects are garbage
|
||||||
|
|
Loading…
Add table
Reference in a new issue