On Wed, May 10, 2017 at 5:37 PM, Andrew Pinski <apin...@cavium.com> wrote: > On Wed, May 10, 2017 at 10:26 AM, Ian Lance Taylor <i...@golang.org> wrote: >> I have committed a large patch to update the Go frontend and libgo to >> the recent changes in the gofrontend repository. I had postponed >> merging changes during the GCC 7 release process. I am now merging >> all the changes that were pending during that period. Although this >> is a merged patch, the changes can be seen individually in the >> gofrontend repo (https://go.googlesource.com/gofrontend). They are >> also listed below. >> >> This is a fairly significant patch that brings in the concurrent >> garbage collector used in the Go 1.8 runtime. This significantly >> reduces pauses due to garbage collection while running a Go program. >> >> This patch also brings in experimental support for AIX for gccgo, >> contributed by Matthieu Sarter and others at Atos Infogérance. >> >> The actual patch is too large for this e-mail patch, but I have >> attached all the changes to the gcc/go directory. >> >> Ian > > > This causes a build failure on aarch64-linux-gnu: > ../../../gcc/libgo/runtime/proc.c: In function ‘runtime_malg’: > ../../../gcc/libgo/runtime/proc.c:729:43: warning: implicit > declaration of function ‘mstats’; did you mean ‘mstart1’? > [-Wimplicit-function-declaration] > void *p = runtime_sysAlloc(stacksize, &mstats()->other_sys); > ^~~~~~ > mstart1 > ../../../gcc/libgo/runtime/proc.c:729:51: error: invalid type argument > of ‘->’ (have ‘int’) > void *p = runtime_sysAlloc(stacksize, &mstats()->other_sys);
Sorry about that. I intended to test on a non-split-stack system, but I forgot. This patch fixes the build problem and lets most of the testsuite pass. I still see two test failures on non-split-stack that I need to look into (index0-out and runtime on 32-bit systems). Patch tested on x86_64-pc-linux-gnu with and without split-stack enabled. Committed to mainline. Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 247948) +++ gcc/go/gofrontend/MERGE (working copy) @@ -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: libgo/go/runtime/runtime2.go =================================================================== --- libgo/go/runtime/runtime2.go (revision 247931) +++ libgo/go/runtime/runtime2.go (working copy) @@ -793,3 +793,10 @@ type g_ucontext_t [(_sizeof_ucontext_t + // 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: libgo/runtime/proc.c =================================================================== --- libgo/runtime/proc.c (revision 247848) +++ libgo/runtime/proc.c (working copy) @@ -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 si // 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: libgo/runtime/stack.c =================================================================== --- libgo/runtime/stack.c (revision 247848) +++ libgo/runtime/stack.c (working copy) @@ -80,7 +80,6 @@ static void doscanstack1(G *gp, void *gc scanstackblock(sp, (uintptr)(spsize), gcw); } #else - M *mp; byte* bottom; byte* top;