Debugging icyc crash

This commit is contained in:
Justin Ethier 2015-04-17 14:18:46 -04:00
parent 8a6a54a017
commit 6f4581543d
2 changed files with 44 additions and 1 deletions

View file

@ -10,7 +10,7 @@
#define CYCLONE_H #define CYCLONE_H
/* Debug GC flag */ /* Debug GC flag */
#define DEBUG_GC 0 #define DEBUG_GC 1
/* Show diagnostic information for the GC when program terminate */ /* Show diagnostic information for the GC when program terminate */
#define DEBUG_SHOW_DIAG 0 #define DEBUG_SHOW_DIAG 0

View file

@ -1749,6 +1749,49 @@ static void main_main (stack_size,heap_size,stack_base)
#if DEBUG_GC #if DEBUG_GC
printf("Done with GC\n"); printf("Done with GC\n");
#endif #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); do_dispatch(gc_num_ans, ((closure)gc_cont)->fn, gc_cont, gc_ans);
/* */ /* */