summaryrefslogtreecommitdiff
path: root/libgo/go/runtime
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 20:52:43 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 20:52:43 +0000
commit12ebd6294172cc1108bbadab78fea03e890a6da4 (patch)
tree4f2fad1f4b778519bdd5941185c7e1d032af055b /libgo/go/runtime
parent6effa4dc115122a3a4838de0a302dfcadcefeeca (diff)
downloadgcc-12ebd6294172cc1108bbadab78fea03e890a6da4.tar.gz
libgo: Update Go library to master revision 15489/921e53d4863c.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195560 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r--libgo/go/runtime/debug/stack.go2
-rw-r--r--libgo/go/runtime/mgc0.go5
-rw-r--r--libgo/go/runtime/pprof/pprof_test.go3
-rw-r--r--libgo/go/runtime/proc_test.go15
-rw-r--r--libgo/go/runtime/runtime_test.go41
5 files changed, 60 insertions, 6 deletions
diff --git a/libgo/go/runtime/debug/stack.go b/libgo/go/runtime/debug/stack.go
index a533a5c3bf4..2896b21417a 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 a7ddaf0a7cb..b1505466222 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 474011523e3..5762e17d36d 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 1d51c5271e3..bf97fb148dd 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 d68b363e998..e458793491d 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)
+ }
+}