runtime: fix build for non-split-stack systems
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 12 May 2017 12:49:34 +0000 (12:49 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 12 May 2017 12:49:34 +0000 (12:49 +0000)
    Change memory allocation accounting for stacks to use stacks_sys,
    since that seems to be what it is for.

    Reviewed-on: https://go-review.googlesource.com/43297

From-SVN: r247967

gcc/go/gofrontend/MERGE
libgo/go/runtime/runtime2.go
libgo/runtime/proc.c
libgo/runtime/stack.c

index 557e270527c317be2011e07338aa538ccf86a297..f4bcf46e46ea652ddcc27fa7b13f872657e5e7ce 100644 (file)
@@ -1,4 +1,4 @@
-3c1258156a2ae483c5cc523cb7a3c3374cbe7c2c
+d5bfa6cebb19a154cbfbc53f6e647d2ca7adef68
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 8deb6202bae4fa2168fa8e952c3f841202a39dab..8bfdcbc9523addaa8081dbe082ab4f21dea6f64b 100644 (file)
@@ -793,3 +793,10 @@ type g_ucontext_t [(_sizeof_ucontext_t + 15) / unsafe.Sizeof(uintptr(0))]uintptr
 // sigset is the Go version of the C type sigset_t.
 // _sigset_t is defined by the Makefile from <signal.h>.
 type sigset _sigset_t
+
+// getMemstats returns a pointer to the internal memstats variable,
+// for C code.
+//go:linkname getMemstats runtime.getMemstats
+func getMemstats() *mstats {
+       return &memstats
+}
index cc56642bff54ba4249c289b3c41d6218ec745acb..14ee673dc47e94fd4e17ab3d012032e6c6898922 100644 (file)
@@ -406,6 +406,8 @@ extern void globrunqput(G*)
   __asm__(GOSYM_PREFIX "runtime.globrunqput");
 extern P* pidleget(void)
   __asm__(GOSYM_PREFIX "runtime.pidleget");
+extern struct mstats* getMemstats(void)
+  __asm__(GOSYM_PREFIX "runtime.getMemstats");
 
 bool runtime_isstarted;
 
@@ -726,7 +728,7 @@ runtime_malg(bool allocatestack, bool signalstack, byte** ret_stack, uintptr* re
                 // 32-bit mode, the Go allocation space is all of
                 // memory anyhow.
                if(sizeof(void*) == 8) {
-                       void *p = runtime_sysAlloc(stacksize, &mstats()->other_sys);
+                       void *p = runtime_sysAlloc(stacksize, &getMemstats()->stacks_sys);
                        if(p == nil)
                                runtime_throw("runtime: cannot allocate memory for goroutine stack");
                        *ret_stack = (byte*)p;
index 98f98fe0a82f0b03ad3b20fdb6b72b2cf175d915..1ce30db00cdc103e1ca80c069b85963f175b0849 100644 (file)
@@ -80,7 +80,6 @@ static void doscanstack1(G *gp, void *gcw) {
                        scanstackblock(sp, (uintptr)(spsize), gcw);
        }
 #else
-       M *mp;
        byte* bottom;
        byte* top;