changeset 58:4c22fe798779

Some small optimizations
author Mike Pavone <pavone@retrodev.com>
date Thu, 08 Oct 2009 03:03:48 -0400
parents 2174878a6e4b
children 4f1ae6eb71d8
files runtime/fib.c runtime/func.h
diffstat 2 files changed, 4 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/fib.c	Thu Oct 08 02:12:25 2009 -0400
+++ b/runtime/fib.c	Thu Oct 08 03:03:48 2009 -0400
@@ -63,7 +63,6 @@
 	cdata = alloc_cdata(ct, NULL, 0);
 	cdata->num_params = 0;
 	cdata->func = END;
-	resume = 0;
 _dispatch:
 switch(func)
 {
@@ -131,40 +130,34 @@
 	lv_Fib->out = NULL;
 	
 	PrepCall(2)
+	
 	SetParam(0, add_ref(cdata->lastframe->params[0]))
 	SetParam(1, add_ref(_const_Whole_SP_Number__2))
 	Call(_LT_, 
 		NumParams 2, 1, Fib)
 	lv_Fib->____result__1__0 = cdata->params[0];
-	FreeCall
 	
-	PrepCall(2)
 	SetParam(0, add_ref(lv_Fib->____result__1__0))
 	Call(If, 
 		NumParams 1, 2, Fib)
 	lv_Fib->____result__0__0 = cdata->params[0];
 	lv_Fib->____result__0__1 = cdata->params[-1];
-	FreeCall
 	
 	if(lv_Fib->____result__0__1)
 	{
-		PrepCall(2)
 		SetParam(0, add_ref(cdata->lastframe->params[0]))
 		SetParam(1, add_ref(_const_Whole_SP_Number__1))
 		Call(_MN_,
 			NumParams 2, 3, Fib)
 		lv_Fib->____result__7__0 = cdata->params[0];
-		FreeCall
 	}
 	if(lv_Fib->____result__0__1)
 	{
-		PrepCall(2)
 		SetParam(0, add_ref(cdata->lastframe->params[0]))
 		SetParam(1, add_ref(_const_Whole_SP_Number__2))
 		Call(_MN_,
 			NumParams 2, 4, Fib)
 		lv_Fib->____result__11__0 = cdata->params[0];
-		FreeCall
 	}
 	if(lv_Fib->____result__0__0)
 	{
@@ -172,32 +165,27 @@
 	}
 	if(lv_Fib->____result__0__1)
 	{
-		PrepCall(1)
 		SetParam(0, add_ref(lv_Fib->____result__7__0))
 		Call(Fib,
 			NumParams 1, 5, Fib)
 		lv_Fib->____result__6__0 = cdata->params[0];
-		FreeCall
 	}
 	if(lv_Fib->____result__0__1)
 	{
-		PrepCall(1)
 		SetParam(0, add_ref(lv_Fib->____result__11__0))
 		Call(Fib,
 			NumParams 1, 6, Fib)
 		lv_Fib->____result__10__0 = cdata->params[0];
-		FreeCall
 	}
 	if(lv_Fib->____result__0__1)
 	{
-		PrepCall(2)
 		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];
-		FreeCall
 	}
+	FreeCall
 	if(lv_Fib->____result__0__1)
 	{
 		lv_Fib->out = add_ref(lv_Fib->____result__5__0);
--- a/runtime/func.h	Thu Oct 08 02:12:25 2009 -0400
+++ b/runtime/func.h	Thu Oct 08 03:03:48 2009 -0400
@@ -18,17 +18,17 @@
 
 #define Func(name,numparams) \
 	case FUNC_ ## name:\
-f_ ## name:\
 		for(idx = numparams; idx < cdata->num_params; ++idx)\
 			release_ref(cdata->params[0-idx]); cdata->num_params = numparams;\
+f_ ## name:\
 		lv_ ## name = alloc_stack(ct, sizeof(lt_ ## name));
 
 
 #define FuncNoLocals(name,numparams) \
 	case FUNC_ ## name:\
-f_ ## name:\
 		for(idx = numparams; idx < cdata->num_params; ++idx)\
 			release_ref(cdata->params[0-idx]); cdata->num_params = numparams;\
+f_ ## name:		
 
 #define EndFunc(name)	\
 		free_stack(ct, lv_ ## name);\
@@ -43,8 +43,6 @@
 #define Method(name) \
 	case FUNC_ ## name:\
 f_ ## name:\
-		if (cdata->num_params < 1)\
-			goto _exception;\
 		switch(get_blueprint(cdata->params[0])->type_id)\
 		{