From 2ad7a4c05b4bf7f2fd0ca37d32a1a68798e7c268 Mon Sep 17 00:00:00 2001 From: Itamar Date: Tue, 10 Mar 2009 20:19:54 +0200 Subject: [PATCH] crushed another bug - the builtin null? returned a new scheme bool object instead of sc_false / sc_true. --- compiler.sml | 2 +- src/c/builtins.c | 12 ++++++++++-- src/c/rtemgr.c | 12 ++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/compiler.sml b/compiler.sml index 3565ac1..1342680 100644 --- a/compiler.sml +++ b/compiler.sml @@ -89,7 +89,7 @@ struct fun compileSchemeFile (infile:string, outfile:string) : unit = stringToFile ( outfile, - (compile ((* (fileToString "./src/scm/support-code.scm")^ *) + (compile ( (fileToString "./src/scm/support-code.scm")^ (fileToString infile)))); end; (* of struct CodeGen *) diff --git a/src/c/builtins.c b/src/c/builtins.c index 8a7e5cd..1f7e995 100644 --- a/src/c/builtins.c +++ b/src/c/builtins.c @@ -167,7 +167,11 @@ LbinaryLT: ASSERT_ALWAYS(IS_SOB_INT((SchemeObject*)r[1]), ""); r[1] = SOB_INT_VALUE((SchemeObject*)r[1]); r_res = ((int)r[0] < (int)r[1]); /* compare as signed integers */ - r_res = (int)makeSchemeBool( r_res ); + if ( r_res ) goto LbinaryLT_true; + r_res = (int)&sc_false; + BI_RETURN(); +LbinaryLT_true: + r_res = (int)&sc_true; BI_RETURN(); Lbox: @@ -179,7 +183,11 @@ Lbox: Lnull: ASSERT_ALWAYS( BI_ST_ARG_COUNT()==1,MSG_ERR_ARGCOUNT("null?",1) ); r[0] = BI_ST_ARG(0); - r_res = (int)makeSchemeBool( IS_SOB_NIL(r[0]) ); + if ( IS_SOB_NIL(r[0]) ) goto Lnull_true; + r_res = (int)&sc_false; + BI_RETURN(); +Lnull_true: + r_res = (int)&sc_true; BI_RETURN(); Lchar_to_integer: diff --git a/src/c/rtemgr.c b/src/c/rtemgr.c index 20e2c17..afaba7e 100644 --- a/src/c/rtemgr.c +++ b/src/c/rtemgr.c @@ -64,21 +64,21 @@ LendExtend1: } /* Prepares the stack for a tail-call. - Overrides the last activation frame with the current one, + Overrides the current activation frame with the new one, fixes sp,fp */ void shiftActFrmDown() { - int low; /* lowest address of the activation frame (included) */ - int high; /* highest address of the activation frame (included) */ - int dest_low; /* lowest address where to put the activation frame */ + int low; /* lowest address of the new activation frame (included) */ + int high; /* highest address of the new activation frame (included) */ + int dest_low; /* lowest address where to put the new activation frame */ - int old_fp = ST_OLDFP(); + int old_fp = ST_OLDFP(); /* save it as its about to be overwritten */ /* Shift activation frame down the stack */ low = fp; high = sp-1; - dest_low = old_fp; + dest_low = ST_FRMEND(); while (low <= high) { stack[dest_low] = stack[low]; -- 2.11.4.GIT