runtime: allow arbitrary return type in SetFinalizer.
finalize chan, to free OS X semaphore inside Lock.
os: finalize File, to close fd.
Fixes #503.
R=ken2
CC=golang-dev
https://golang.org/cl/204065
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index b162f46..5bd92dd 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -766,11 +766,18 @@
void
·newproc(int32 siz, byte* fn, byte* arg0)
{
+ newproc1(fn, (byte*)&arg0, siz, 0);
+}
+
+void
+newproc1(byte *fn, byte *argp, int32 narg, int32 nret)
+{
byte *stk, *sp;
G *newg;
+ int32 siz;
-//printf("newproc siz=%d fn=%p", siz, fn);
-
+//printf("newproc1 %p %p narg=%d nret=%d\n", fn, argp, narg, nret);
+ siz = narg + nret;
siz = (siz+7) & ~7;
if(siz > 1024)
throw("runtime.newproc: too many args");
@@ -793,7 +800,7 @@
newg->stackbase = sp;
sp -= siz;
- mcpy(sp, (byte*)&arg0, siz);
+ mcpy(sp, argp, narg);
newg->sched.sp = sp;
newg->sched.pc = (byte*)goexit;