changeset 9:52d9948def24

Limit stack use in Int32 in prep for stack unwind changes
author Mike Pavone <pavone@retrodev.com>
date Sat, 16 May 2009 23:22:45 -0400
parents 8d74ef7fa357
children 0f2c4ee070fe
files runtime/func.h runtime/integer.c
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/func.h	Wed May 13 23:37:19 2009 -0400
+++ b/runtime/func.h	Sat May 16 23:22:45 2009 -0400
@@ -19,6 +19,7 @@
 #define FuncNoLocals(name,numparams) returntype _f_ ## name (calldata * cdata) {calldata *call; returntype ret; int idx; for(idx = numparams; idx < cdata->num_params; ++idx) release_ref(cdata->params[idx]); cdata->num_params = numparams;
 #define EndFunc	return NORMAL_RETURN; }
 #define Method(name,type,numparams,locals) returntype MethodName(name,type) (calldata * cdata) { locals; calldata *call; returntype ret; int idx; for(idx = numparams; idx < cdata->num_params; ++idx) release_ref(cdata->params[idx]); cdata->num_params = numparams;
+#define MethodNoLocals(name,type,numparams) returntype MethodName(name,type) (calldata * cdata) { calldata *call; returntype ret; int idx; for(idx = numparams; idx < cdata->num_params; ++idx) release_ref(cdata->params[idx]); cdata->num_params = numparams;
 #define ParamBase(num,var,type,convtypeid) \
 call->params[0] = cdata->params[num];\
 ret = coerce_value(convtypeid, call);\
--- a/runtime/integer.c	Wed May 13 23:37:19 2009 -0400
+++ b/runtime/integer.c	Sat May 16 23:22:45 2009 -0400
@@ -2,8 +2,10 @@
 #include "builtin.h"
 #include "context.h"
 
-Method(_PL_,Int32,2,
-	_t_Int32 * left; _t_Int32 * right)
+#define left ((_t_Int32 *)cdata->params[0])
+#define right ((_t_Int32 *)cdata->params[1])
+
+MethodNoLocals(_PL_,Int32,2)
 	call = alloc_cdata(cdata->ct, 1);
 	CopiedParam(0, left, Int32, TYPE_INT32)
 	Param(1, right, Int32, TYPE_INT32)
@@ -13,8 +15,7 @@
 	release_ref((object *)right);
 EndFunc
 
-Method(_MN_,Int32,2,
-	_t_Int32 * left; _t_Int32 * right)
+MethodNoLocals(_MN_,Int32,2)
 	call = alloc_cdata(cdata->ct, 1);
 	CopiedParam(0, left, Int32, TYPE_INT32)
 	Param(1, right, Int32, TYPE_INT32)