Commit 8cce07d1 by Ian Lance Taylor

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
parent 31a84d4a
880cb0a45590d992880fc6aabc7484e54c817eeb 314ba28067383516c213ba84c931f93325a48c39
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -515,7 +515,6 @@ runtime_files = \ ...@@ -515,7 +515,6 @@ runtime_files = \
lfstack.c \ lfstack.c \
malloc.c \ malloc.c \
netpoll.c \ netpoll.c \
rdebug.c \
reflect.c \ reflect.c \
runtime1.c \ runtime1.c \
sigqueue.c \ sigqueue.c \
...@@ -3035,6 +3034,7 @@ TEST_PACKAGES = \ ...@@ -3035,6 +3034,7 @@ TEST_PACKAGES = \
os/user/check \ os/user/check \
path/filepath/check \ path/filepath/check \
regexp/syntax/check \ regexp/syntax/check \
runtime/debug/check \
runtime/pprof/check \ runtime/pprof/check \
runtime/internal/atomic/check \ runtime/internal/atomic/check \
runtime/internal/sys/check \ runtime/internal/sys/check \
......
...@@ -262,7 +262,7 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ ...@@ -262,7 +262,7 @@ am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \
$(am__objects_2) panic.lo parfor.lo print.lo proc.lo \ $(am__objects_2) panic.lo parfor.lo print.lo proc.lo \
runtime.lo signal_unix.lo thread.lo $(am__objects_3) yield.lo \ runtime.lo signal_unix.lo thread.lo $(am__objects_3) yield.lo \
$(am__objects_4) go-iface.lo lfstack.lo malloc.lo netpoll.lo \ $(am__objects_4) go-iface.lo lfstack.lo malloc.lo netpoll.lo \
rdebug.lo reflect.lo runtime1.lo sigqueue.lo $(am__objects_5) reflect.lo runtime1.lo sigqueue.lo $(am__objects_5)
am_libgo_llgo_la_OBJECTS = $(am__objects_6) am_libgo_llgo_la_OBJECTS = $(am__objects_6)
libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS) libgo_llgo_la_OBJECTS = $(am_libgo_llgo_la_OBJECTS)
libgo_llgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ libgo_llgo_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
...@@ -913,7 +913,6 @@ runtime_files = \ ...@@ -913,7 +913,6 @@ runtime_files = \
lfstack.c \ lfstack.c \
malloc.c \ malloc.c \
netpoll.c \ netpoll.c \
rdebug.c \
reflect.c \ reflect.c \
runtime1.c \ runtime1.c \
sigqueue.c \ sigqueue.c \
...@@ -1384,6 +1383,7 @@ TEST_PACKAGES = \ ...@@ -1384,6 +1383,7 @@ TEST_PACKAGES = \
os/user/check \ os/user/check \
path/filepath/check \ path/filepath/check \
regexp/syntax/check \ regexp/syntax/check \
runtime/debug/check \
runtime/pprof/check \ runtime/pprof/check \
runtime/internal/atomic/check \ runtime/internal/atomic/check \
runtime/internal/sys/check \ runtime/internal/sys/check \
...@@ -1624,7 +1624,6 @@ distclean-compile: ...@@ -1624,7 +1624,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parfor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parfor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdebug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems-task-variable-add.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems-task-variable-add.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime.Plo@am__quote@
......
...@@ -16,17 +16,10 @@ type GCStats struct { ...@@ -16,17 +16,10 @@ type GCStats struct {
NumGC int64 // number of garbage collections NumGC int64 // number of garbage collections
PauseTotal time.Duration // total pause for all collections PauseTotal time.Duration // total pause for all collections
Pause []time.Duration // pause history, most recent first Pause []time.Duration // pause history, most recent first
PauseEnd []time.Time // pause end times history, most recent first
PauseQuantiles []time.Duration PauseQuantiles []time.Duration
} }
// Implemented in package runtime.
func readGCStats(*[]time.Duration)
func enableGC(bool) bool
func setGCPercent(int) int
func freeOSMemory()
func setMaxStack(int) int
func setMaxThreads(int) int
// ReadGCStats reads statistics about garbage collection into stats. // ReadGCStats reads statistics about garbage collection into stats.
// The number of entries in the pause history is system-dependent; // The number of entries in the pause history is system-dependent;
// stats.Pause slice will be reused if large enough, reallocated otherwise. // stats.Pause slice will be reused if large enough, reallocated otherwise.
...@@ -38,25 +31,36 @@ func setMaxThreads(int) int ...@@ -38,25 +31,36 @@ func setMaxThreads(int) int
func ReadGCStats(stats *GCStats) { func ReadGCStats(stats *GCStats) {
// Create a buffer with space for at least two copies of the // Create a buffer with space for at least two copies of the
// pause history tracked by the runtime. One will be returned // pause history tracked by the runtime. One will be returned
// to the caller and the other will be used as a temporary buffer // to the caller and the other will be used as transfer buffer
// for computing quantiles. // for end times history and as a temporary buffer for
// computing quantiles.
const maxPause = len(((*runtime.MemStats)(nil)).PauseNs) const maxPause = len(((*runtime.MemStats)(nil)).PauseNs)
if cap(stats.Pause) < 2*maxPause { if cap(stats.Pause) < 2*maxPause+3 {
stats.Pause = make([]time.Duration, 2*maxPause) stats.Pause = make([]time.Duration, 2*maxPause+3)
} }
// readGCStats fills in the pause history (up to maxPause entries) // readGCStats fills in the pause and end times histories (up to
// and then three more: Unix ns time of last GC, number of GC, // maxPause entries) and then three more: Unix ns time of last GC,
// and total pause time in nanoseconds. Here we depend on the // number of GC, and total pause time in nanoseconds. Here we
// fact that time.Duration's native unit is nanoseconds, so the // depend on the fact that time.Duration's native unit is
// pauses and the total pause time do not need any conversion. // nanoseconds, so the pauses and the total pause time do not need
// any conversion.
readGCStats(&stats.Pause) readGCStats(&stats.Pause)
n := len(stats.Pause) - 3 n := len(stats.Pause) - 3
stats.LastGC = time.Unix(0, int64(stats.Pause[n])) stats.LastGC = time.Unix(0, int64(stats.Pause[n]))
stats.NumGC = int64(stats.Pause[n+1]) stats.NumGC = int64(stats.Pause[n+1])
stats.PauseTotal = stats.Pause[n+2] stats.PauseTotal = stats.Pause[n+2]
n /= 2 // buffer holds pauses and end times
stats.Pause = stats.Pause[:n] stats.Pause = stats.Pause[:n]
if cap(stats.PauseEnd) < maxPause {
stats.PauseEnd = make([]time.Time, 0, maxPause)
}
stats.PauseEnd = stats.PauseEnd[:0]
for _, ns := range stats.Pause[n : n+n] {
stats.PauseEnd = append(stats.PauseEnd, time.Unix(0, int64(ns)))
}
if len(stats.PauseQuantiles) > 0 { if len(stats.PauseQuantiles) > 0 {
if n == 0 { if n == 0 {
for i := range stats.PauseQuantiles { for i := range stats.PauseQuantiles {
...@@ -91,9 +95,9 @@ func (x byDuration) Less(i, j int) bool { return x[i] < x[j] } ...@@ -91,9 +95,9 @@ func (x byDuration) Less(i, j int) bool { return x[i] < x[j] }
// at startup, or 100 if the variable is not set. // at startup, or 100 if the variable is not set.
// A negative percentage disables garbage collection. // A negative percentage disables garbage collection.
func SetGCPercent(percent int) int { func SetGCPercent(percent int) int {
old := setGCPercent(percent) old := setGCPercent(int32(percent))
runtime.GC() runtime.GC()
return old return int(old)
} }
// FreeOSMemory forces a garbage collection followed by an // FreeOSMemory forces a garbage collection followed by an
...@@ -145,7 +149,9 @@ func SetMaxThreads(threads int) int { ...@@ -145,7 +149,9 @@ func SetMaxThreads(threads int) int {
// that the runtime trigger only a panic, not a crash. // that the runtime trigger only a panic, not a crash.
// SetPanicOnFault applies only to the current goroutine. // SetPanicOnFault applies only to the current goroutine.
// It returns the previous setting. // It returns the previous setting.
func SetPanicOnFault(enabled bool) bool func SetPanicOnFault(enabled bool) bool {
return setPanicOnFault(enabled)
}
// WriteHeapDump writes a description of the heap and the objects in // WriteHeapDump writes a description of the heap and the objects in
// it to the given file descriptor. // it to the given file descriptor.
......
...@@ -71,6 +71,19 @@ func TestReadGCStats(t *testing.T) { ...@@ -71,6 +71,19 @@ func TestReadGCStats(t *testing.T) {
t.Errorf("stats.PauseQuantiles[%d]=%d > stats.PauseQuantiles[%d]=%d", i, q[i], i+1, q[i+1]) t.Errorf("stats.PauseQuantiles[%d]=%d > stats.PauseQuantiles[%d]=%d", i, q[i], i+1, q[i+1])
} }
} }
// compare memory stats with gc stats:
if len(stats.PauseEnd) != n {
t.Fatalf("len(stats.PauseEnd) = %d, want %d", len(stats.PauseEnd), n)
}
off := (int(mstats.NumGC) + len(mstats.PauseEnd) - 1) % len(mstats.PauseEnd)
for i := 0; i < n; i++ {
dt := stats.PauseEnd[i]
if dt.UnixNano() != int64(mstats.PauseEnd[off]) {
t.Errorf("stats.PauseEnd[%d] = %d, want %d", i, dt, mstats.PauseEnd[off])
}
off = (off + len(mstats.PauseEnd) - 1) % len(mstats.PauseEnd)
}
} }
var big = make([]byte, 1<<20) var big = make([]byte, 1<<20)
......
...@@ -50,10 +50,12 @@ func TestStack(t *testing.T) { ...@@ -50,10 +50,12 @@ func TestStack(t *testing.T) {
check(t, lines[n], line) check(t, lines[n], line)
n++ n++
} }
frame("stack_test.go", "\tmethod.N15_runtime_debug.T: return Stack()") n++
frame("stack_test.go", "\tmethod.N15_runtime_debug.T: return t.ptrmethod()") frame("stack.go", "runtime_debug.Stack")
frame("stack_test.go", "\tTestStack: b := T(0).method()") frame("stack_test.go", "ptrmethod")
frame("testing/testing.go", "") frame("stack_test.go", "method")
frame("stack_test.go", "runtime_debug_test.TestStack")
frame("testing.go", "")
} }
func check(t *testing.T, line, has string) { func check(t *testing.T, line, has string) {
......
// Copyright 2014 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 debug
import (
"time"
)
// Implemented in package runtime.
func readGCStats(*[]time.Duration)
func freeOSMemory()
func setMaxStack(int) int
func setGCPercent(int32) int32
func setPanicOnFault(bool) bool
func setMaxThreads(int) int
...@@ -623,7 +623,7 @@ func Stack(buf []byte, all bool) int { ...@@ -623,7 +623,7 @@ func Stack(buf []byte, all bool) int {
gp.m.traceback = 1 gp.m.traceback = 1
gp.writebuf = buf[0:0:len(buf)] gp.writebuf = buf[0:0:len(buf)]
goroutineheader(gp) goroutineheader(gp)
traceback() traceback(1)
if all { if all {
tracebackothers(gp) tracebackothers(gp)
} }
...@@ -653,7 +653,7 @@ func tracealloc(p unsafe.Pointer, size uintptr, typ *_type) { ...@@ -653,7 +653,7 @@ func tracealloc(p unsafe.Pointer, size uintptr, typ *_type) {
} }
if gp.m.curg == nil || gp == gp.m.curg { if gp.m.curg == nil || gp == gp.m.curg {
goroutineheader(gp) goroutineheader(gp)
traceback() traceback(1)
} else { } else {
goroutineheader(gp.m.curg) goroutineheader(gp.m.curg)
// FIXME: Can't do traceback of other g. // FIXME: Can't do traceback of other g.
...@@ -669,7 +669,7 @@ func tracefree(p unsafe.Pointer, size uintptr) { ...@@ -669,7 +669,7 @@ func tracefree(p unsafe.Pointer, size uintptr) {
gp.m.traceback = 2 gp.m.traceback = 2
print("tracefree(", p, ", ", hex(size), ")\n") print("tracefree(", p, ", ", hex(size), ")\n")
goroutineheader(gp) goroutineheader(gp)
traceback() traceback(1)
print("\n") print("\n")
gp.m.traceback = 0 gp.m.traceback = 0
unlock(&tracelock) unlock(&tracelock)
......
// Copyright 2014 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
import _ "unsafe" // for go:linkname
// Define maxstacksize here for gccgo. For gc it is defined in
// stack.go, but gccgo doesn't use that file. Or, for that matter,
// maxstacksize.
var maxstacksize uintptr = 1 << 20 // enough until runtime.main sets it for real
//go:linkname setMaxStack runtime_debug.setMaxStack
func setMaxStack(in int) (out int) {
out = int(maxstacksize)
maxstacksize = uintptr(in)
return out
}
//go:linkname setPanicOnFault runtime_debug.setPanicOnFault
func setPanicOnFault(new bool) (old bool) {
_g_ := getg()
old = _g_.paniconfault
_g_.paniconfault = new
return old
}
...@@ -444,3 +444,19 @@ func setprofilebucket(p unsafe.Pointer, b *bucket) ...@@ -444,3 +444,19 @@ func setprofilebucket(p unsafe.Pointer, b *bucket)
// Currently in proc.c. // Currently in proc.c.
func tracebackothers(*g) func tracebackothers(*g)
// Temporary for gccgo until we port mgc.go.
func setgcpercent(int32) int32
//go:linkname setGCPercent runtime_debug.setGCPercent
func setGCPercent(in int32) (out int32) {
return setgcpercent(in)
}
// Temporary for gccgo until we port proc.go.
func setmaxthreads(int) int
//go:linkname setMaxThreads runtime_debug.setMaxThreads
func setMaxThreads(in int) (out int) {
return setmaxthreads(in)
}
...@@ -67,9 +67,9 @@ func callers(skip int, locbuf []location) int { ...@@ -67,9 +67,9 @@ func callers(skip int, locbuf []location) int {
// traceback prints a traceback of the current goroutine. // traceback prints a traceback of the current goroutine.
// This differs from the gc version, which is given pc, sp, lr and g and // This differs from the gc version, which is given pc, sp, lr and g and
// can print a traceback of any goroutine. // can print a traceback of any goroutine.
func traceback() { func traceback(skip int32) {
var locbuf [100]location var locbuf [100]location
c := c_callers(1, &locbuf[0], int32(len(locbuf)), false) c := c_callers(skip+1, &locbuf[0], int32(len(locbuf)), false)
printtrace(locbuf[:c], getg()) printtrace(locbuf[:c], getg())
} }
...@@ -77,7 +77,7 @@ func traceback() { ...@@ -77,7 +77,7 @@ func traceback() {
func printtrace(locbuf []location, gp *g) { func printtrace(locbuf []location, gp *g) {
for i := range locbuf { for i := range locbuf {
if showframe(locbuf[i].function, gp) { if showframe(locbuf[i].function, gp) {
print(locbuf[i].function, "\n\t", locbuf[i].filename, ":", locbuf[i].lineno) print(locbuf[i].function, "\n\t", locbuf[i].filename, ":", locbuf[i].lineno, "\n")
} }
} }
} }
......
...@@ -222,7 +222,7 @@ runtime_sighandler (int sig, Siginfo *info, ...@@ -222,7 +222,7 @@ runtime_sighandler (int sig, Siginfo *info,
G *g; G *g;
g = runtime_g (); g = runtime_g ();
runtime_traceback (); runtime_traceback (0);
runtime_tracebackothers (g); runtime_tracebackothers (g);
/* The gc library calls runtime_dumpregs here, and provides /* The gc library calls runtime_dumpregs here, and provides
......
...@@ -545,6 +545,8 @@ dumpmemprof_callback(Bucket *b, uintptr nstk, Location *stk, uintptr size, uintp ...@@ -545,6 +545,8 @@ dumpmemprof_callback(Bucket *b, uintptr nstk, Location *stk, uintptr size, uintp
dumpint(frees); dumpint(frees);
} }
static FuncVal dumpmemprof_callbackv = {(void(*)(void))dumpmemprof_callback};
static void static void
dumpmemprof(void) dumpmemprof(void)
{ {
...@@ -554,7 +556,7 @@ dumpmemprof(void) ...@@ -554,7 +556,7 @@ dumpmemprof(void)
SpecialProfile *spp; SpecialProfile *spp;
byte *p; byte *p;
runtime_iterate_memprof(dumpmemprof_callback); runtime_iterate_memprof(&dumpmemprof_callbackv);
allspans = runtime_mheap.allspans; allspans = runtime_mheap.allspans;
for(spanidx=0; spanidx<runtime_mheap.nspan; spanidx++) { for(spanidx=0; spanidx<runtime_mheap.nspan; spanidx++) {
......
...@@ -465,7 +465,7 @@ void runtime_MProf_Free(Bucket*, uintptr, bool) ...@@ -465,7 +465,7 @@ void runtime_MProf_Free(Bucket*, uintptr, bool)
__asm__ (GOSYM_PREFIX "runtime.mProf_Free"); __asm__ (GOSYM_PREFIX "runtime.mProf_Free");
void runtime_MProf_GC(void) void runtime_MProf_GC(void)
__asm__ (GOSYM_PREFIX "runtime.mProf_GC"); __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"); __asm__ (GOSYM_PREFIX "runtime.iterate_memprof");
int32 runtime_gcprocs(void); int32 runtime_gcprocs(void);
void runtime_helpgc(int32 nproc); void runtime_helpgc(int32 nproc);
...@@ -535,7 +535,8 @@ void runtime_gc_g_ptr(Eface*); ...@@ -535,7 +535,8 @@ void runtime_gc_g_ptr(Eface*);
void runtime_gc_itab_ptr(Eface*); void runtime_gc_itab_ptr(Eface*);
void runtime_memorydump(void); 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. // Value we use to mark dead pointers when GODEBUG=gcdead=1.
#define PoisonGC ((uintptr)0xf969696969696969ULL) #define PoisonGC ((uintptr)0xf969696969696969ULL)
......
...@@ -2392,14 +2392,16 @@ runtime_debug_readGCStats(Slice *pauses) ...@@ -2392,14 +2392,16 @@ runtime_debug_readGCStats(Slice *pauses)
// pause_ns[(numgc-1)%nelem(pause_ns)], and then backward // pause_ns[(numgc-1)%nelem(pause_ns)], and then backward
// from there to go back farther in time. We deliver the times // from there to go back farther in time. We deliver the times
// most recent first (in p[0]). // 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[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+n] = pmstats->last_gc;
p[n+1] = pmstats->numgc; p[n+n+1] = pmstats->numgc;
p[n+2] = pmstats->pause_total_ns; p[n+n+2] = pmstats->pause_total_ns;
runtime_unlock(&runtime_mheap); runtime_unlock(&runtime_mheap);
pauses->__count = n+3; pauses->__count = n+n+3;
} }
int32 int32
......
...@@ -130,11 +130,11 @@ runtime_dopanic(int32 unused __attribute__ ((unused))) ...@@ -130,11 +130,11 @@ runtime_dopanic(int32 unused __attribute__ ((unused)))
if(g != runtime_m()->g0) { if(g != runtime_m()->g0) {
runtime_printf("\n"); runtime_printf("\n");
runtime_goroutineheader(g); runtime_goroutineheader(g);
runtime_traceback(); runtime_traceback(0);
runtime_printcreatedby(g); runtime_printcreatedby(g);
} else if(t >= 2 || runtime_m()->throwing > 0) { } else if(t >= 2 || runtime_m()->throwing > 0) {
runtime_printf("\nruntime stack:\n"); runtime_printf("\nruntime stack:\n");
runtime_traceback(); runtime_traceback(0);
} }
if(!didothers) { if(!didothers) {
didothers = true; didothers = true;
......
...@@ -3470,14 +3470,14 @@ runtime_testSchedLocalQueueSteal(void) ...@@ -3470,14 +3470,14 @@ runtime_testSchedLocalQueueSteal(void)
} }
} }
int32 intgo
runtime_setmaxthreads(int32 in) runtime_setmaxthreads(intgo in)
{ {
int32 out; intgo out;
runtime_lock(&runtime_sched); runtime_lock(&runtime_sched);
out = runtime_sched.maxmcount; out = (intgo)runtime_sched.maxmcount;
runtime_sched.maxmcount = in; runtime_sched.maxmcount = (int32)in;
checkmcount(); checkmcount();
runtime_unlock(&runtime_sched); runtime_unlock(&runtime_sched);
return out; return out;
......
// 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;
}
...@@ -151,10 +151,6 @@ runtime_setdebug(struct debugVars* d) { ...@@ -151,10 +151,6 @@ runtime_setdebug(struct debugVars* d) {
runtime_debug = *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) void memclrBytes(Slice)
__asm__ (GOSYM_PREFIX "runtime.memclrBytes"); __asm__ (GOSYM_PREFIX "runtime.memclrBytes");
......
...@@ -230,7 +230,7 @@ enum { ...@@ -230,7 +230,7 @@ enum {
}; };
void runtime_hashinit(void); void runtime_hashinit(void);
void runtime_traceback(void) void runtime_traceback(int32)
__asm__ (GOSYM_PREFIX "runtime.traceback"); __asm__ (GOSYM_PREFIX "runtime.traceback");
void runtime_tracebackothers(G*) void runtime_tracebackothers(G*)
__asm__ (GOSYM_PREFIX "runtime.tracebackothers"); __asm__ (GOSYM_PREFIX "runtime.tracebackothers");
...@@ -256,7 +256,6 @@ extern int8* runtime_goos; ...@@ -256,7 +256,6 @@ extern int8* runtime_goos;
extern int32 runtime_ncpu; extern int32 runtime_ncpu;
extern void (*runtime_sysargs)(int32, uint8**); extern void (*runtime_sysargs)(int32, uint8**);
extern struct debugVars runtime_debug; extern struct debugVars runtime_debug;
extern uintptr runtime_maxstacksize;
extern bool runtime_isstarted; extern bool runtime_isstarted;
extern bool runtime_isarchive; extern bool runtime_isarchive;
...@@ -411,7 +410,8 @@ void runtime_crash(void); ...@@ -411,7 +410,8 @@ void runtime_crash(void);
void runtime_parsedebugvars(void) void runtime_parsedebugvars(void)
__asm__(GOSYM_PREFIX "runtime.parsedebugvars"); __asm__(GOSYM_PREFIX "runtime.parsedebugvars");
void _rt0_go(void); void _rt0_go(void);
int32 runtime_setmaxthreads(int32); intgo runtime_setmaxthreads(intgo)
__asm__ (GOSYM_PREFIX "runtime.setmaxthreads");
G* runtime_timejump(void); G* runtime_timejump(void);
void runtime_iterate_finq(void (*callback)(FuncVal*, void*, const FuncType*, const PtrType*)); void runtime_iterate_finq(void (*callback)(FuncVal*, void*, const FuncType*, const PtrType*));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment