diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-10-17 16:54:25 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-10-17 16:54:25 +0000 |
commit | 8cce07d1ddccd9ffcdcaafaaa4cf13ffa95ec360 (patch) | |
tree | 99f8a824655109bd2cd36ab0a8502e2fd713101a /libgo/runtime | |
parent | 31a84d4a65c9e820fa6f928f8a031f6dfe213c85 (diff) | |
download | gcc-8cce07d1ddccd9ffcdcaafaaa4cf13ffa95ec360.zip gcc-8cce07d1ddccd9ffcdcaafaaa4cf13ffa95ec360.tar.gz gcc-8cce07d1ddccd9ffcdcaafaaa4cf13ffa95ec360.tar.bz2 |
runtime: copy rdebug code from Go 1.7 runtime
While we're at it, update the runtime/debug package, and start running
its testsuite by default. I'm not sure why runtime/debug was not
previously updated to 1.7. Doing that led me to fix some minor aspects
of runtime.Stack and the C function runtime/debug.readGCStats.
Reviewed-on: https://go-review.googlesource.com/31251
From-SVN: r241261
Diffstat (limited to 'libgo/runtime')
-rw-r--r-- | libgo/runtime/go-signal.c | 2 | ||||
-rw-r--r-- | libgo/runtime/heapdump.c | 4 | ||||
-rw-r--r-- | libgo/runtime/malloc.h | 5 | ||||
-rw-r--r-- | libgo/runtime/mgc0.c | 12 | ||||
-rw-r--r-- | libgo/runtime/panic.c | 4 | ||||
-rw-r--r-- | libgo/runtime/proc.c | 10 | ||||
-rw-r--r-- | libgo/runtime/rdebug.goc | 26 | ||||
-rw-r--r-- | libgo/runtime/runtime.c | 4 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 6 |
9 files changed, 24 insertions, 49 deletions
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 99829eb..e3e4a19 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -222,7 +222,7 @@ runtime_sighandler (int sig, Siginfo *info, G *g; g = runtime_g (); - runtime_traceback (); + runtime_traceback (0); runtime_tracebackothers (g); /* The gc library calls runtime_dumpregs here, and provides diff --git a/libgo/runtime/heapdump.c b/libgo/runtime/heapdump.c index 158ff5e..afab0b4 100644 --- a/libgo/runtime/heapdump.c +++ b/libgo/runtime/heapdump.c @@ -545,6 +545,8 @@ dumpmemprof_callback(Bucket *b, uintptr nstk, Location *stk, uintptr size, uintp dumpint(frees); } +static FuncVal dumpmemprof_callbackv = {(void(*)(void))dumpmemprof_callback}; + static void dumpmemprof(void) { @@ -554,7 +556,7 @@ dumpmemprof(void) SpecialProfile *spp; byte *p; - runtime_iterate_memprof(dumpmemprof_callback); + runtime_iterate_memprof(&dumpmemprof_callbackv); allspans = runtime_mheap.allspans; for(spanidx=0; spanidx<runtime_mheap.nspan; spanidx++) { diff --git a/libgo/runtime/malloc.h b/libgo/runtime/malloc.h index e674c88..f37f206 100644 --- a/libgo/runtime/malloc.h +++ b/libgo/runtime/malloc.h @@ -465,7 +465,7 @@ void runtime_MProf_Free(Bucket*, uintptr, bool) __asm__ (GOSYM_PREFIX "runtime.mProf_Free"); void runtime_MProf_GC(void) __asm__ (GOSYM_PREFIX "runtime.mProf_GC"); -void runtime_iterate_memprof(void (*callback)(Bucket*, uintptr, Location*, uintptr, uintptr, uintptr)) +void runtime_iterate_memprof(FuncVal* callback) __asm__ (GOSYM_PREFIX "runtime.iterate_memprof"); int32 runtime_gcprocs(void); void runtime_helpgc(int32 nproc); @@ -535,7 +535,8 @@ void runtime_gc_g_ptr(Eface*); void runtime_gc_itab_ptr(Eface*); void runtime_memorydump(void); -int32 runtime_setgcpercent(int32); +int32 runtime_setgcpercent(int32) + __asm__ (GOSYM_PREFIX "runtime.setgcpercent"); // Value we use to mark dead pointers when GODEBUG=gcdead=1. #define PoisonGC ((uintptr)0xf969696969696969ULL) diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c index 0b96696..84353c7 100644 --- a/libgo/runtime/mgc0.c +++ b/libgo/runtime/mgc0.c @@ -2392,14 +2392,16 @@ runtime_debug_readGCStats(Slice *pauses) // pause_ns[(numgc-1)%nelem(pause_ns)], and then backward // from there to go back farther in time. We deliver the times // most recent first (in p[0]). - for(i=0; i<n; i++) + for(i=0; i<n; i++) { p[i] = pmstats->pause_ns[(pmstats->numgc-1-i)%nelem(pmstats->pause_ns)]; + p[n+i] = pmstats->pause_end[(pmstats->numgc-1-i)%nelem(pmstats->pause_ns)]; + } - p[n] = pmstats->last_gc; - p[n+1] = pmstats->numgc; - p[n+2] = pmstats->pause_total_ns; + p[n+n] = pmstats->last_gc; + p[n+n+1] = pmstats->numgc; + p[n+n+2] = pmstats->pause_total_ns; runtime_unlock(&runtime_mheap); - pauses->__count = n+3; + pauses->__count = n+n+3; } int32 diff --git a/libgo/runtime/panic.c b/libgo/runtime/panic.c index cd1ae96..0dd6776 100644 --- a/libgo/runtime/panic.c +++ b/libgo/runtime/panic.c @@ -130,11 +130,11 @@ runtime_dopanic(int32 unused __attribute__ ((unused))) if(g != runtime_m()->g0) { runtime_printf("\n"); runtime_goroutineheader(g); - runtime_traceback(); + runtime_traceback(0); runtime_printcreatedby(g); } else if(t >= 2 || runtime_m()->throwing > 0) { runtime_printf("\nruntime stack:\n"); - runtime_traceback(); + runtime_traceback(0); } if(!didothers) { didothers = true; diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index 7d65c4b..9838c7f 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -3470,14 +3470,14 @@ runtime_testSchedLocalQueueSteal(void) } } -int32 -runtime_setmaxthreads(int32 in) +intgo +runtime_setmaxthreads(intgo in) { - int32 out; + intgo out; runtime_lock(&runtime_sched); - out = runtime_sched.maxmcount; - runtime_sched.maxmcount = in; + out = (intgo)runtime_sched.maxmcount; + runtime_sched.maxmcount = (int32)in; checkmcount(); runtime_unlock(&runtime_sched); return out; diff --git a/libgo/runtime/rdebug.goc b/libgo/runtime/rdebug.goc deleted file mode 100644 index 63eb4dd..0000000 --- a/libgo/runtime/rdebug.goc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime_debug -#include "runtime.h" -#include "arch.h" -#include "malloc.h" - -func setMaxStack(in int) (out int) { - out = runtime_maxstacksize; - runtime_maxstacksize = in; -} - -func setGCPercent(in int) (out int) { - out = runtime_setgcpercent(in); -} - -func setMaxThreads(in int) (out int) { - out = runtime_setmaxthreads(in); -} - -func SetPanicOnFault(enabled bool) (old bool) { - old = runtime_g()->paniconfault; - runtime_g()->paniconfault = enabled; -} diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c index 70331f4..16be089 100644 --- a/libgo/runtime/runtime.c +++ b/libgo/runtime/runtime.c @@ -151,10 +151,6 @@ runtime_setdebug(struct debugVars* d) { runtime_debug = *d; } -// Setting the max stack size doesn't really do anything for gccgo. - -uintptr runtime_maxstacksize = 1<<20; // enough until runtime.main sets it for real - void memclrBytes(Slice) __asm__ (GOSYM_PREFIX "runtime.memclrBytes"); diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index f73d745..dedc574 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -230,7 +230,7 @@ enum { }; void runtime_hashinit(void); -void runtime_traceback(void) +void runtime_traceback(int32) __asm__ (GOSYM_PREFIX "runtime.traceback"); void runtime_tracebackothers(G*) __asm__ (GOSYM_PREFIX "runtime.tracebackothers"); @@ -256,7 +256,6 @@ extern int8* runtime_goos; extern int32 runtime_ncpu; extern void (*runtime_sysargs)(int32, uint8**); extern struct debugVars runtime_debug; -extern uintptr runtime_maxstacksize; extern bool runtime_isstarted; extern bool runtime_isarchive; @@ -411,7 +410,8 @@ void runtime_crash(void); void runtime_parsedebugvars(void) __asm__(GOSYM_PREFIX "runtime.parsedebugvars"); void _rt0_go(void); -int32 runtime_setmaxthreads(int32); +intgo runtime_setmaxthreads(intgo) + __asm__ (GOSYM_PREFIX "runtime.setmaxthreads"); G* runtime_timejump(void); void runtime_iterate_finq(void (*callback)(FuncVal*, void*, const FuncType*, const PtrType*)); |