Mercurial > repos > rhope
diff runtime/fib.c @ 61:fa24ef3b026f
Added macro for tail calls with new C strategy
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 08 Oct 2009 23:16:26 -0400 |
parents | 4f1ae6eb71d8 |
children |
line wrap: on
line diff
--- a/runtime/fib.c Thu Oct 08 22:54:39 2009 -0400 +++ b/runtime/fib.c Thu Oct 08 23:16:26 2009 -0400 @@ -20,7 +20,6 @@ FUNC_Fib_4, FUNC_Fib_5, FUNC_Fib_6, - FUNC_Fib_7, FUNC_If, FUNC_If_AT_Yes_SP_No, FUNC_Main, @@ -44,7 +43,6 @@ case FUNC_Fib_4: goto r4_Fib;\ case FUNC_Fib_5: goto r5_Fib;\ case FUNC_Fib_6: goto r6_Fib;\ - case FUNC_Fib_7: goto r7_Fib;\ case FUNC_If: goto f_If;\ case FUNC_If_AT_Yes_SP_No: goto f_If_AT_Yes_SP_No;\ case FUNC_Main: goto f_Main;\ @@ -207,11 +205,32 @@ } if(lv_Fib->____result__0__1) { - SetParam(0, add_ref(lv_Fib->____result__6__0)) - SetParam(1, add_ref(lv_Fib->____result__10__0)) - Call(_PL_, - NumParams 2, 7, Fib) - lv_Fib->____result__5__0 = cdata->params[0]; + if(lv_Fib->____result__0__0) + { + release_ref(lv_Fib->____result__0__0); + } + if(lv_Fib->____result__0__1) + { + release_ref(lv_Fib->____result__0__1); + } + if(lv_Fib->____result__1__0) + { + release_ref(lv_Fib->____result__1__0); + } + if(lv_Fib->____result__7__0) + { + release_ref(lv_Fib->____result__7__0); + } + if(lv_Fib->____result__11__0) + { + release_ref(lv_Fib->____result__11__0); + } + TPrepCall(2) + SetParam(0, lv_Fib->____result__6__0) + SetParam(1, lv_Fib->____result__10__0) + TCall(_PL_, + NumParams 2) + //lv_Fib->____result__5__0 = cdata->params[0]; } FreeCall if(lv_Fib->____result__0__1)