]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: mark sysAlloc nosplit
authorRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 01:12:48 +0000 (21:12 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 01:12:48 +0000 (21:12 -0400)
sysAlloc is the only mem function called from Go.

LGTM=iant, khr
R=golang-codereviews, khr, 0intro, iant
CC=dvyukov, golang-codereviews, r
https://golang.org/cl/139210043

src/pkg/runtime/mem_darwin.c
src/pkg/runtime/mem_dragonfly.c
src/pkg/runtime/mem_freebsd.c
src/pkg/runtime/mem_linux.c
src/pkg/runtime/mem_nacl.c
src/pkg/runtime/mem_netbsd.c
src/pkg/runtime/mem_openbsd.c
src/pkg/runtime/mem_plan9.c
src/pkg/runtime/mem_solaris.c
src/pkg/runtime/mem_windows.c

index ca0ac72de99e6d02254d688d925700e4c328f94d..72a2d18ad6c4701506dfde2a1aa650031bd8ed79 100644 (file)
@@ -7,7 +7,9 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index 55410cef64e264eb9fbbc40c194d98888c366d5f..11457b2c030ce9025176fe4edc70c6c2dfffcb13 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "textflag.h"
 
 enum
 {
        ENOMEM = 12,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index a033bfcdc069e31f328557529216c7ec178e5cc3..18a9a2f5b331059701d4cc489b50ed3d09379e26 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "textflag.h"
 
 enum
 {
        ENOMEM = 12,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index 429f820f8bfcf7a9eebe1a33d87139d463dc56f4..01e7707bbcae6d5061b7ad88ea6ab362e4c1c5ad 100644 (file)
@@ -7,6 +7,7 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum
 {
@@ -57,6 +58,7 @@ mmap_fixed(byte *v, uintptr n, int32 prot, int32 flags, int32 fd, uint32 offset)
        return p;
 }
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index 5c5f806324515196c67c276e1238e2021faf6724..968fe8da5426b3acc5402c6d154afd9379060d2f 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum
 {
        Debug = 0,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index cf4b24f92000108d6635e31417c551624f164780..8d04c832cec9328329bc84614bc915b67effe2f3 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum
 {
        ENOMEM = 12,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index cf4b24f92000108d6635e31417c551624f164780..8d04c832cec9328329bc84614bc915b67effe2f3 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum
 {
        ENOMEM = 12,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index aec652995f21a9e89a4539e6e7e528e671f83734..4f753adb4d50a53ae75034d7e9e848b4f91d08bc 100644 (file)
@@ -7,6 +7,7 @@
 #include "arch_GOARCH.h"
 #include "malloc.h"
 #include "os_GOOS.h"
+#include "../../cmd/ld/textflag.h"
 
 extern byte runtime·end[];
 static byte *bloc = { runtime·end };
@@ -31,18 +32,41 @@ brk(uintptr nbytes)
        }
        bloc = (byte*)bl + nbytes;
        runtime·unlock(&memlock);
-       return (void*)bl;
-       
+       return (void*)bl;       
 }
 
-void*
-runtime·sysAlloc(uintptr nbytes, uint64 *stat)
+static void
+sysalloc(void)
 {
+       uintptr nbytes;
+       uint64 *stat;
        void *p;
 
+       nbytes = g->m->scalararg[0];
+       stat = g->m->ptrarg[0];
+       g->m->scalararg[0] = 0;
+       g->m->ptrarg[0] = nil;
+
        p = brk(nbytes);
        if(p != nil)
                runtime·xadd64(stat, nbytes);
+
+       g->m->ptrarg[0] = p;
+}
+
+#pragma textflag NOSPLIT
+void*
+runtime·sysAlloc(uintptr nbytes, uint64 *stat)
+{
+       void (*fn)(void);
+       void *p;
+
+       g->m->scalararg[0] = nbytes;
+       g->m->ptrarg[0] = stat;
+       fn = sysalloc;
+       runtime·onM(&fn);
+       p = g->m->ptrarg[0];
+       g->m->ptrarg[0] = nil;
        return p;
 }
 
index 87536f6837255ca4067fec2662b714eabc7b5cd4..01cbe9e1a4f6dac34076d1d45355a3cbda388b64 100644 (file)
@@ -7,12 +7,14 @@
 #include "defs_GOOS_GOARCH.h"
 #include "os_GOOS.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum
 {
        ENOMEM = 12,
 };
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {
index cb1c9de907b25ff2df71ea3e672876a8ce67d64c..33ce003d28a523d58ba417edb71e0c10daae52a4 100644 (file)
@@ -7,6 +7,7 @@
 #include "os_GOOS.h"
 #include "defs_GOOS_GOARCH.h"
 #include "malloc.h"
+#include "../../cmd/ld/textflag.h"
 
 enum {
        MEM_COMMIT = 0x1000,
@@ -25,6 +26,7 @@ extern void *runtime·VirtualAlloc;
 extern void *runtime·VirtualFree;
 extern void *runtime·VirtualProtect;
 
+#pragma textflag NOSPLIT
 void*
 runtime·sysAlloc(uintptr n, uint64 *stat)
 {