summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/386/closure.c
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
committerOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
commit3e45412327a2654a77944249962b3652e6142299 (patch)
treebc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/pkg/runtime/386/closure.c
parentc533680039762cacbc37db8dc7eed074c3e497be (diff)
downloadgolang-upstream/2011.01.12.tar.gz
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/pkg/runtime/386/closure.c')
-rw-r--r--src/pkg/runtime/386/closure.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/pkg/runtime/386/closure.c b/src/pkg/runtime/386/closure.c
index 9f639c472..b0d4cc41a 100644
--- a/src/pkg/runtime/386/closure.c
+++ b/src/pkg/runtime/386/closure.c
@@ -9,23 +9,20 @@
// fn func(arg0, arg1, arg2 *ptr, callerpc uintptr, xxx) yyy,
// arg0, arg1, arg2 *ptr) (func(xxx) yyy)
void
-·closure(int32 siz, byte *fn, byte *arg0)
+runtime·closure(int32 siz, byte *fn, byte *arg0)
{
byte *p, *q, **ret;
int32 i, n;
int32 pcrel;
- if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
- throw("no closures in native client yet");
-
if(siz < 0 || siz%4 != 0)
- throw("bad closure size");
+ runtime·throw("bad closure size");
ret = (byte**)((byte*)&arg0 + siz);
if(siz > 100) {
// TODO(rsc): implement stack growth preamble?
- throw("closure too big");
+ runtime·throw("closure too big");
}
// compute size of new fn.
@@ -43,12 +40,12 @@ void
if(n%4)
n += 4 - n%4;
- p = mal(n);
+ p = runtime·mal(n);
*ret = p;
q = p + n - siz;
if(siz > 0) {
- mcpy(q, (byte*)&arg0, siz);
+ runtime·mcpy(q, (byte*)&arg0, siz);
// SUBL $siz, SP
*p++ = 0x81;
@@ -104,7 +101,5 @@ void
*p++ = 0xc3;
if(p > q)
- throw("bad math in sys.closure");
+ runtime·throw("bad math in sys.closure");
}
-
-