diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-01-29 20:52:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-01-29 20:52:43 +0000 |
commit | d6f2922e91928b5191a5c5f1b3a6b320712b5ce3 (patch) | |
tree | 4f2fad1f4b778519bdd5941185c7e1d032af055b /libgo/go/runtime | |
parent | 91bfca59095b1cca9d4364996866848eaaf76c26 (diff) | |
download | gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.zip gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.gz gcc-d6f2922e91928b5191a5c5f1b3a6b320712b5ce3.tar.bz2 |
libgo: Update Go library to master revision 15489/921e53d4863c.
From-SVN: r195560
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r-- | libgo/go/runtime/debug/stack.go | 2 | ||||
-rw-r--r-- | libgo/go/runtime/mgc0.go | 5 | ||||
-rw-r--r-- | libgo/go/runtime/pprof/pprof_test.go | 3 | ||||
-rw-r--r-- | libgo/go/runtime/proc_test.go | 15 | ||||
-rw-r--r-- | libgo/go/runtime/runtime_test.go | 41 |
5 files changed, 60 insertions, 6 deletions
diff --git a/libgo/go/runtime/debug/stack.go b/libgo/go/runtime/debug/stack.go index a533a5c..2896b21 100644 --- a/libgo/go/runtime/debug/stack.go +++ b/libgo/go/runtime/debug/stack.go @@ -29,6 +29,8 @@ func PrintStack() { // For each routine, it includes the source line information and PC value, // then attempts to discover, for Go functions, the calling function or // method and the text of the line containing the invocation. +// +// This function is deprecated. Use package runtime's Stack instead. func Stack() []byte { return stack() } diff --git a/libgo/go/runtime/mgc0.go b/libgo/go/runtime/mgc0.go index a7ddaf0..b150546 100644 --- a/libgo/go/runtime/mgc0.go +++ b/libgo/go/runtime/mgc0.go @@ -8,3 +8,8 @@ package runtime func gc_m_ptr(ret *interface{}) { *ret = (*m)(nil) } + +// Called from C. Returns the Go type *itab. +func gc_itab_ptr(ret *interface{}) { + *ret = (*itab)(nil) +} diff --git a/libgo/go/runtime/pprof/pprof_test.go b/libgo/go/runtime/pprof/pprof_test.go index 4740115..5762e17 100644 --- a/libgo/go/runtime/pprof/pprof_test.go +++ b/libgo/go/runtime/pprof/pprof_test.go @@ -27,8 +27,7 @@ func TestCPUProfile(t *testing.T) { t.Logf("uname -a: %v", vers) // Lion uses "Darwin Kernel Version 11". if strings.Contains(vers, "Darwin Kernel Version 10") && strings.Contains(vers, "RELEASE_X86_64") { - t.Logf("skipping test on known-broken kernel (64-bit Leopard / Snow Leopard)") - return + t.Skip("skipping test on known-broken kernel (64-bit Leopard / Snow Leopard)") } case "plan9": // unimplemented diff --git a/libgo/go/runtime/proc_test.go b/libgo/go/runtime/proc_test.go index 1d51c52..bf97fb1 100644 --- a/libgo/go/runtime/proc_test.go +++ b/libgo/go/runtime/proc_test.go @@ -22,8 +22,7 @@ func perpetuumMobile() { func TestStopTheWorldDeadlock(t *testing.T) { if testing.Short() { - t.Logf("skipping during short test") - return + t.Skip("skipping during short test") } maxprocs := runtime.GOMAXPROCS(3) compl := make(chan bool, 2) @@ -53,7 +52,7 @@ func stackGrowthRecursive(i int) { } } -func BenchmarkStackGrowth(b *testing.B) { +func benchmarkStackGrowth(b *testing.B, rec int) { const CallsPerSched = 1000 procs := runtime.GOMAXPROCS(-1) N := int32(b.N / CallsPerSched) @@ -63,7 +62,7 @@ func BenchmarkStackGrowth(b *testing.B) { for atomic.AddInt32(&N, -1) >= 0 { runtime.Gosched() for g := 0; g < CallsPerSched; g++ { - stackGrowthRecursive(10) + stackGrowthRecursive(rec) } } c <- true @@ -74,6 +73,14 @@ func BenchmarkStackGrowth(b *testing.B) { } } +func BenchmarkStackGrowth(b *testing.B) { + benchmarkStackGrowth(b, 10) +} + +func BenchmarkStackGrowthDeep(b *testing.B) { + benchmarkStackGrowth(b, 1024) +} + func BenchmarkSyscall(b *testing.B) { const CallsPerSched = 1000 procs := runtime.GOMAXPROCS(-1) diff --git a/libgo/go/runtime/runtime_test.go b/libgo/go/runtime/runtime_test.go index d68b363..e458793 100644 --- a/libgo/go/runtime/runtime_test.go +++ b/libgo/go/runtime/runtime_test.go @@ -38,3 +38,44 @@ func BenchmarkIfaceCmpNil100(b *testing.B) { } } } + +func BenchmarkDefer(b *testing.B) { + for i := 0; i < b.N; i++ { + defer1() + } +} + +func defer1() { + defer func(x, y, z int) { + if recover() != nil || x != 1 || y != 2 || z != 3 { + panic("bad recover") + } + }(1, 2, 3) + return +} + +func BenchmarkDefer10(b *testing.B) { + for i := 0; i < b.N/10; i++ { + defer2() + } +} + +func defer2() { + for i := 0; i < 10; i++ { + defer func(x, y, z int) { + if recover() != nil || x != 1 || y != 2 || z != 3 { + panic("bad recover") + } + }(1, 2, 3) + } +} + +func BenchmarkDeferMany(b *testing.B) { + for i := 0; i < b.N; i++ { + defer func(x, y, z int) { + if recover() != nil || x != 1 || y != 2 || z != 3 { + panic("bad recover") + } + }(1, 2, 3) + } +} |