From 6f4581543d6aad795bf0bb614a2ae57b4bdce855 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 17 Apr 2015 14:18:46 -0400 Subject: [PATCH] Debugging icyc crash --- cyclone.h | 2 +- runtime.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/cyclone.h b/cyclone.h index 0636beaf..9451e316 100644 --- a/cyclone.h +++ b/cyclone.h @@ -10,7 +10,7 @@ #define CYCLONE_H /* Debug GC flag */ -#define DEBUG_GC 0 +#define DEBUG_GC 1 /* Show diagnostic information for the GC when program terminate */ #define DEBUG_SHOW_DIAG 0 diff --git a/runtime.h b/runtime.h index 47550f5c..38338175 100644 --- a/runtime.h +++ b/runtime.h @@ -1749,6 +1749,49 @@ static void main_main (stack_size,heap_size,stack_base) #if DEBUG_GC printf("Done with GC\n"); #endif + +// TODO: received a primitive as gc_cont - WTF? +// 1) may way to examine the closureN that is also received, to see if +// it yields any clues (such as it's fn) +// 2) looks like it is crashing in parser code +// an over-simplification: +// parse => reverse => foldl => (prim cont) +// +// { +// int i; +// function_type fn; +// if (type_of(gc_cont) == cons_tag) { +// // for reference: +// //#define funcall1(cfn,a1) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(0, (closure)a1, cfn); } else { ((cfn)->fn)(1,cfn,a1);} +// printf("after GC, not handling cons type yet\n"); +// exit(1); +// } else if (prim(gc_cont)) { +// // this is broken anyway, as a prim does not have a continuation chain. +// // should never encounter a primitive after GC +// fn = ((primitive)gc_cont)->fn; +// +// // below is not correct, just experimenting +// gc_cont = gc_ans[0]; +// for (i = 1; i < gc_num_ans; i++){ +// gc_ans[i - 1] = gc_ans[i]; +// } +// gc_num_ans--; +// } else { +// fn = ((closure)gc_cont)->fn; +// } +// printf("After GC, cont = "); +// Cyc_display(gc_cont); +// printf("\n args = \n"); +// for (i = 0; i < gc_num_ans; i++){ +// if (is_object_type(gc_ans[i])) { +// printf(" tag = %d ", type_of(gc_ans[i])); +// } +// printf(" arg = "); +// Cyc_display(gc_ans[i]); +// printf("\n"); +// } +// do_dispatch(gc_num_ans, fn, gc_cont, gc_ans); +// } do_dispatch(gc_num_ans, ((closure)gc_cont)->fn, gc_cont, gc_ans); /* */