This commit is contained in:
Justin Ethier 2015-04-17 22:17:48 -04:00
parent e44ece1986
commit 897e310d44
2 changed files with 6 additions and 55 deletions

3
TODO
View file

@ -1,7 +1,6 @@
Working TODO list: Working TODO list:
- (+ 1 2 3) is only crashing on dedicated PC - WTF? - need to cleanup ex handler output in icyc.scm
need to cleanup ex handler output in icyc.scm
remove debug lines from runtime raise function remove debug lines from runtime raise function
- Fixup Cyc_sum to use varargs and call (error) if anything bad happens. then generalize to - * / - Fixup Cyc_sum to use varargs and call (error) if anything bad happens. then generalize to - * /

View file

@ -1773,59 +1773,11 @@ static void main_main (stack_size,heap_size,stack_base)
printf("Done with GC\n"); printf("Done with GC\n");
#endif #endif
// TODO: received a primitive as gc_cont - WTF? if (type_of(gc_cont) == cons_tag || prim(gc_cont)) {
// 1) may way to examine the closureN that is also received, to see if Cyc_apply_from_buf(gc_num_ans, gc_cont, gc_ans);
// it yields any clues (such as it's fn) } else {
// 2) looks like it is crashing in parser code do_dispatch(gc_num_ans, ((closure)gc_cont)->fn, gc_cont, gc_ans);
// an over-simplification: }
// parse => reverse => foldl => (prim cont)
// 3) could be looking at this all wrong. we do the following in funcall:
// //#define funcall1(cfn,a1) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(0, (closure)a1, cfn); } else { ((cfn)->fn)(1,cfn,a1);}
// isn't it obvious we need to do the same thing after GC (called via return_funcall)? instead we just
// try to call the prim directly, and predictably the call fails...
/// I think this is the solution!
//
// {
// 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);
// }
if (type_of(gc_cont) == cons_tag || prim(gc_cont)) {
printf("DEBUG, prim found after GC\n");
Cyc_apply_from_buf(gc_num_ans, gc_cont, gc_ans);
} else {
do_dispatch(gc_num_ans, ((closure)gc_cont)->fn, gc_cont, gc_ans);
}
/* */ /* */
printf("main: your setjmp and/or longjmp are broken.\n"); exit(0);}} printf("main: your setjmp and/or longjmp are broken.\n"); exit(0);}}