diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 3400505c..a23fd45e 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -45,6 +45,9 @@ // Number of functions to save for printing call history #define MAX_STACK_TRACES 10 +// Show diagnostic information for the GC when program terminates +#define DEBUG_SHOW_DIAG 0 + // GC debugging flags #define GC_DEBUG_TRACE 0 #define GC_DEBUG_VERBOSE 0 @@ -152,9 +155,6 @@ typedef enum { STAGE_CLEAR_OR_MARKING #define gc_color_red 0 // Memory not to be GC'd, such as on the stack #define gc_color_blue 2 // Unallocated memory -/* Show diagnostic information for the GC when program terminates */ -#define DEBUG_SHOW_DIAG 0 - /* Define size of object tags */ typedef long tag_type; diff --git a/runtime.c b/runtime.c index 38797967..67f093b5 100644 --- a/runtime.c +++ b/runtime.c @@ -1586,9 +1586,7 @@ object Cyc_integer2char(void *data, object n){ void Cyc_halt(closure); void Cyc_halt(env) closure env; { #if DEBUG_SHOW_DIAG - printf("Cyc_halt: heap bytes allocated=%d time=%ld ticks no_gcs=%ld no_m_gcs=%ld\n", - allocp-bottom,clock()-start,no_gcs,no_major_gcs); - printf("Cyc_halt: ticks/second=%ld\n",(long) CLOCKS_PER_SEC); + gc_print_stats(Cyc_heap); #endif exit(0);} @@ -2107,6 +2105,9 @@ void _cyc_exit(void *data, object cont, object args) { __halt(car(args)); } void __75halt(void *data, object cont, object args) { +#if DEBUG_SHOW_DIAG + gc_print_stats(Cyc_heap); +#endif exit(0); } void _cell_91get(void *data, object cont, object args) { printf("not implemented\n"); exit(1); }