mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-11 14:57:36 +02:00
Added debug statements
This commit is contained in:
parent
6ad6f6e254
commit
ff1fc10a90
3 changed files with 12 additions and 11 deletions
20
gc.c
20
gc.c
|
@ -354,11 +354,13 @@ if (is_value_type(result)) {
|
|||
return result;
|
||||
}
|
||||
|
||||
size_t gc_allocated_bytes(object obj)
|
||||
size_t gc_allocated_bytes(object obj, gc_free_list *q, gc_free_list *r)
|
||||
{
|
||||
tag_type t;
|
||||
if (is_value_type(obj)) {
|
||||
fprintf(stdout, "gc_allocated_bytes - passed value type %p\n", obj);
|
||||
fprintf(stdout,
|
||||
"gc_allocated_bytes - passed value type %p q=[%p, %d] r=[%p, %d]\n",
|
||||
obj, q, q->size, r, r->size);
|
||||
exit(1);
|
||||
//return gc_heap_align(1);
|
||||
}
|
||||
|
@ -486,7 +488,7 @@ size_t gc_sweep(gc_heap *h, size_t *sum_freed_ptr)
|
|||
//#endif
|
||||
continue;
|
||||
}
|
||||
size = gc_heap_align(gc_allocated_bytes(p));
|
||||
size = gc_heap_align(gc_allocated_bytes(p, q, r));
|
||||
//fprintf(stdout, "check object %p, size = %d\n", p, size);
|
||||
|
||||
//#if GC_DEBUG_CONCISE_PRINTFS
|
||||
|
@ -507,12 +509,10 @@ size_t gc_sweep(gc_heap *h, size_t *sum_freed_ptr)
|
|||
//#endif
|
||||
|
||||
if (mark(p) == gc_color_clear) {
|
||||
#if GC_DEBUG_PRINTFS
|
||||
fprintf(stdout, "sweep: object is not marked %p\n", p);
|
||||
//fprintf(stdout, "sweep is freeing obj: %p ", p);
|
||||
//Cyc_display(p, stdout);
|
||||
//fprintf(stdout, "\n");
|
||||
#endif
|
||||
//#if GC_DEBUG_PRINTFS
|
||||
//fprintf(stdout, "sweep: object is not marked %p\n", p);
|
||||
fprintf(stdout, "sweep is freeing obj: %p with tag %d\n", p, type_of(p));
|
||||
//#endif
|
||||
mark(p) = gc_color_blue; // Needed?
|
||||
// free p
|
||||
sum_freed += size;
|
||||
|
@ -800,7 +800,7 @@ void gc_mut_update(gc_thread_data *thd, object old_obj, object value)
|
|||
//printf("\n");
|
||||
gc_mark_gray(thd, old_obj);
|
||||
// TODO: need this too???
|
||||
gc_stack_mark_gray(thd, value);
|
||||
//gc_stack_mark_gray(thd, value);
|
||||
} else if (stage == STAGE_TRACING) {
|
||||
//printf("DEBUG - GC async tracing marking heap obj %p ", old_obj);
|
||||
//Cyc_display(old_obj, stdout);
|
||||
|
|
|
@ -146,7 +146,7 @@ int gc_grow_heap(gc_heap *h, size_t size, size_t chunk_size);
|
|||
char *gc_copy_obj(object hp, char *obj, gc_thread_data *thd);
|
||||
void *gc_try_alloc(gc_heap *h, size_t size, char *obj, gc_thread_data *thd);
|
||||
void *gc_alloc(gc_heap *h, size_t size, char *obj, gc_thread_data *thd, int *heap_grown);
|
||||
size_t gc_allocated_bytes(object obj);
|
||||
size_t gc_allocated_bytes(object obj, gc_free_list *q, gc_free_list *r);
|
||||
gc_heap *gc_heap_last(gc_heap *h);
|
||||
size_t gc_heap_total_size(gc_heap *h);
|
||||
//size_t gc_collect(gc_heap *h, size_t *sum_freed);
|
||||
|
|
|
@ -2742,6 +2742,7 @@ void GC(void *data, closure cont, object *args, int num_args)
|
|||
// Cooperate with the collector thread
|
||||
gc_mut_cooperate((gc_thread_data *)data);
|
||||
|
||||
printf("done with minor GC\n");
|
||||
// Let it all go, Neo...
|
||||
longjmp(*(((gc_thread_data *)data)->jmp_start), 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue