diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-09-16 15:47:21 +0000 |
commit | adb0401dac41c81571722312d4586b2693f95aa6 (patch) | |
tree | ea2b52e3c258d6b6d9356977c683c7f72a4a5fd5 /gcc | |
parent | 5548ca3540bccbc908a45942896d635ea5f1c23f (diff) | |
download | gcc-adb0401dac41c81571722312d4586b2693f95aa6.tar.gz |
Update Go library to r60.
From-SVN: r178910
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/go.test/go-test.exp | 2 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/chan/select5.go | 290 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/fixedbugs/bug243.go | 3 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/mallocrep.go | 5 | ||||
-rw-r--r-- | gcc/testsuite/go.test/test/mallocrep1.go | 7 |
5 files changed, 156 insertions, 151 deletions
diff --git a/gcc/testsuite/go.test/go-test.exp b/gcc/testsuite/go.test/go-test.exp index f5f2e60bbc3..5068dd7f63d 100644 --- a/gcc/testsuite/go.test/go-test.exp +++ b/gcc/testsuite/go.test/go-test.exp @@ -806,7 +806,7 @@ proc go-gc-tests { } { $status $name } else { verbose -log $comp_output - fali $name + fail $name } file delete $ofile1 $ofile2 $output_file set runtests $hold_runtests diff --git a/gcc/testsuite/go.test/test/chan/select5.go b/gcc/testsuite/go.test/test/chan/select5.go index e7ca9e015c1..60718216712 100644 --- a/gcc/testsuite/go.test/test/chan/select5.go +++ b/gcc/testsuite/go.test/test/chan/select5.go @@ -37,7 +37,7 @@ func main() { } fmt.Fprintln(out, `}`) } - + do(recv) do(send) do(recvOrder) @@ -54,8 +54,8 @@ func run(t *template.Template, a interface{}, out io.Writer) { } } -type arg struct{ - def bool +type arg struct { + def bool nreset int } @@ -135,181 +135,180 @@ func main() { } ` -func parse(s string) *template.Template { - t := template.New(nil) - t.SetDelims("〈", "〉") - if err := t.Parse(s); err != nil { - panic(s) +func parse(name, s string) *template.Template { + t, err := template.New(name).Parse(s) + if err != nil { + panic(fmt.Sprintf("%q: %s", name, err)) } return t } -var recv = parse(` - 〈# Send n, receive it one way or another into x, check that they match.〉 +var recv = parse("recv", ` + {{/* Send n, receive it one way or another into x, check that they match. */}} c <- n - 〈.section Maybe〉 + {{if .Maybe}} x = <-c - 〈.or〉 + {{else}} select { - 〈# Blocking or non-blocking, before the receive.〉 - 〈# The compiler implements two-case select where one is default with custom code,〉 - 〈# so test the default branch both before and after the send.〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking, before the receive. */}} + {{/* The compiler implements two-case select where one is default with custom code, */}} + {{/* so test the default branch both before and after the send. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Receive from c. Different cases are direct, indirect, :=, interface, and map assignment.〉 - 〈.section Maybe〉 + {{end}} + {{/* Receive from c. Different cases are direct, indirect, :=, interface, and map assignment. */}} + {{if .Maybe}} case x = <-c: - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} case *f(&x) = <-c: - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} case y := <-c: x = y - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} case i = <-c: x = i.(int) - 〈.or〉 + {{else}} case m[13] = <-c: x = m[13] - 〈.end〉〈.end〉〈.end〉〈.end〉 - 〈# Blocking or non-blocking again, after the receive.〉 - 〈.section MaybeDefault〉 + {{end}}{{end}}{{end}}{{end}} + {{/* Blocking or non-blocking again, after the receive. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Dummy send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Dummy send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case dummy <- 1: panic("dummy send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-dummy: panic("dummy receive") - 〈.end〉 - 〈# Nil channel send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Nil channel send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case nilch <- 1: panic("nilch send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-nilch: panic("nilch recv") - 〈.end〉 + {{end}} } - 〈.end〉 + {{end}} if x != n { die(x) } n++ `) -var recvOrder = parse(` - 〈# Send n, receive it one way or another into x, check that they match.〉 - 〈# Check order of operations along the way by calling functions that check〉 - 〈# that the argument sequence is strictly increasing.〉 +var recvOrder = parse("recvOrder", ` + {{/* Send n, receive it one way or another into x, check that they match. */}} + {{/* Check order of operations along the way by calling functions that check */}} + {{/* that the argument sequence is strictly increasing. */}} order = 0 c <- n - 〈.section Maybe〉 - 〈# Outside of select, left-to-right rule applies.〉 - 〈# (Inside select, assignment waits until case is chosen,〉 - 〈# so right hand side happens before anything on left hand side.〉 + {{if .Maybe}} + {{/* Outside of select, left-to-right rule applies. */}} + {{/* (Inside select, assignment waits until case is chosen, */}} + {{/* so right hand side happens before anything on left hand side. */}} *fp(&x, 1) = <-fc(c, 2) - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} m[fn(13, 1)] = <-fc(c, 2) x = m[13] - 〈.or〉 + {{else}} select { - 〈# Blocking or non-blocking, before the receive.〉 - 〈# The compiler implements two-case select where one is default with custom code,〉 - 〈# so test the default branch both before and after the send.〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking, before the receive. */}} + {{/* The compiler implements two-case select where one is default with custom code, */}} + {{/* so test the default branch both before and after the send. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Receive from c. Different cases are direct, indirect, :=, interface, and map assignment.〉 - 〈.section Maybe〉 + {{end}} + {{/* Receive from c. Different cases are direct, indirect, :=, interface, and map assignment. */}} + {{if .Maybe}} case *fp(&x, 100) = <-fc(c, 1): - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} case y := <-fc(c, 1): x = y - 〈.or〉〈.section Maybe〉 + {{else}}{{if .Maybe}} case i = <-fc(c, 1): x = i.(int) - 〈.or〉 + {{else}} case m[fn(13, 100)] = <-fc(c, 1): x = m[13] - 〈.end〉〈.end〉〈.end〉 - 〈# Blocking or non-blocking again, after the receive.〉 - 〈.section MaybeDefault〉 + {{end}}{{end}}{{end}} + {{/* Blocking or non-blocking again, after the receive. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Dummy send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Dummy send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case fc(dummy, 2) <- fn(1, 3): panic("dummy send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-fc(dummy, 4): panic("dummy receive") - 〈.end〉 - 〈# Nil channel send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Nil channel send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case fc(nilch, 5) <- fn(1, 6): panic("nilch send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-fc(nilch, 7): panic("nilch recv") - 〈.end〉 + {{end}} } - 〈.end〉〈.end〉 + {{end}}{{end}} if x != n { die(x) } n++ `) -var send = parse(` - 〈# Send n one way or another, receive it into x, check that they match.〉 - 〈.section Maybe〉 +var send = parse("send", ` + {{/* Send n one way or another, receive it into x, check that they match. */}} + {{if .Maybe}} c <- n - 〈.or〉 + {{else}} select { - 〈# Blocking or non-blocking, before the receive (same reason as in recv).〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking, before the receive (same reason as in recv). */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Send c <- n. No real special cases here, because no values come back〉 - 〈# from the send operation.〉 + {{end}} + {{/* Send c <- n. No real special cases here, because no values come back */}} + {{/* from the send operation. */}} case c <- n: - 〈# Blocking or non-blocking.〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Dummy send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Dummy send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case dummy <- 1: panic("dummy send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-dummy: panic("dummy receive") - 〈.end〉 - 〈# Nil channel send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Nil channel send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case nilch <- 1: panic("nilch send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-nilch: panic("nilch recv") - 〈.end〉 + {{end}} } - 〈.end〉 + {{end}} x = <-c if x != n { die(x) @@ -317,48 +316,48 @@ var send = parse(` n++ `) -var sendOrder = parse(` - 〈# Send n one way or another, receive it into x, check that they match.〉 - 〈# Check order of operations along the way by calling functions that check〉 - 〈# that the argument sequence is strictly increasing.〉 +var sendOrder = parse("sendOrder", ` + {{/* Send n one way or another, receive it into x, check that they match. */}} + {{/* Check order of operations along the way by calling functions that check */}} + {{/* that the argument sequence is strictly increasing. */}} order = 0 - 〈.section Maybe〉 + {{if .Maybe}} fc(c, 1) <- fn(n, 2) - 〈.or〉 + {{else}} select { - 〈# Blocking or non-blocking, before the receive (same reason as in recv).〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking, before the receive (same reason as in recv). */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Send c <- n. No real special cases here, because no values come back〉 - 〈# from the send operation.〉 + {{end}} + {{/* Send c <- n. No real special cases here, because no values come back */}} + {{/* from the send operation. */}} case fc(c, 1) <- fn(n, 2): - 〈# Blocking or non-blocking.〉 - 〈.section MaybeDefault〉 + {{/* Blocking or non-blocking. */}} + {{if .MaybeDefault}} default: panic("nonblock") - 〈.end〉 - 〈# Dummy send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Dummy send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case fc(dummy, 3) <- fn(1, 4): panic("dummy send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-fc(dummy, 5): panic("dummy receive") - 〈.end〉 - 〈# Nil channel send, receive to keep compiler from optimizing select.〉 - 〈.section Maybe〉 + {{end}} + {{/* Nil channel send, receive to keep compiler from optimizing select. */}} + {{if .Maybe}} case fc(nilch, 6) <- fn(1, 7): panic("nilch send") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-fc(nilch, 8): panic("nilch recv") - 〈.end〉 + {{end}} } - 〈.end〉 + {{end}} x = <-c if x != n { die(x) @@ -366,49 +365,49 @@ var sendOrder = parse(` n++ `) -var nonblock = parse(` +var nonblock = parse("nonblock", ` x = n - 〈# Test various combinations of non-blocking operations.〉 - 〈# Receive assignments must not edit or even attempt to compute the address of the lhs.〉 + {{/* Test various combinations of non-blocking operations. */}} + {{/* Receive assignments must not edit or even attempt to compute the address of the lhs. */}} select { - 〈.section MaybeDefault〉 + {{if .MaybeDefault}} default: - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case dummy <- 1: panic("dummy <- 1") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case nilch <- 1: panic("nilch <- 1") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-dummy: panic("<-dummy") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case x = <-dummy: panic("<-dummy x") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case **(**int)(nil) = <-dummy: panic("<-dummy (and didn't crash saving result!)") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case <-nilch: panic("<-nilch") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case x = <-nilch: panic("<-nilch x") - 〈.end〉 - 〈.section Maybe〉 + {{end}} + {{if .Maybe}} case **(**int)(nil) = <-nilch: panic("<-nilch (and didn't crash saving result!)") - 〈.end〉 - 〈.section MustDefault〉 + {{end}} + {{if .MustDefault}} default: - 〈.end〉 + {{end}} } if x != n { die(x) @@ -466,7 +465,7 @@ func next() bool { } // increment last choice sequence - cp = len(choices)-1 + cp = len(choices) - 1 for cp >= 0 && choices[cp].i == choices[cp].n-1 { cp-- } @@ -479,4 +478,3 @@ func next() bool { cp = 0 return true } - diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug243.go b/gcc/testsuite/go.test/test/fixedbugs/bug243.go index 0c531968e66..95514cfd650 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/bug243.go +++ b/gcc/testsuite/go.test/test/fixedbugs/bug243.go @@ -38,7 +38,7 @@ func Listen(x, y string) (T, string) { } func (t T) Addr() os.Error { - return os.ErrorString("stringer") + return os.NewError("stringer") } func (t T) Accept() (int, string) { @@ -49,4 +49,3 @@ func Dial(x, y, z string) (int, string) { global <- 1 return 0, "" } - diff --git a/gcc/testsuite/go.test/test/mallocrep.go b/gcc/testsuite/go.test/test/mallocrep.go index 762f3754f5f..9f47e52e2b6 100644 --- a/gcc/testsuite/go.test/test/mallocrep.go +++ b/gcc/testsuite/go.test/test/mallocrep.go @@ -18,6 +18,7 @@ var chatty = flag.Bool("v", false, "chatty") var oldsys uint64 func bigger() { + runtime.UpdateMemStats() if st := runtime.MemStats; oldsys < st.Sys { oldsys = st.Sys if *chatty { @@ -31,7 +32,7 @@ func bigger() { } func main() { - runtime.GC() // clean up garbage from init + runtime.GC() // clean up garbage from init runtime.MemProfileRate = 0 // disable profiler runtime.MemStats.Alloc = 0 // ignore stacks flag.Parse() @@ -45,8 +46,10 @@ func main() { panic("fail") } b := runtime.Alloc(uintptr(j)) + runtime.UpdateMemStats() during := runtime.MemStats.Alloc runtime.Free(b) + runtime.UpdateMemStats() if a := runtime.MemStats.Alloc; a != 0 { println("allocated ", j, ": wrong stats: during=", during, " after=", a, " (want 0)") panic("fail") diff --git a/gcc/testsuite/go.test/test/mallocrep1.go b/gcc/testsuite/go.test/test/mallocrep1.go index eb67bed86ba..0b1479900e6 100644 --- a/gcc/testsuite/go.test/test/mallocrep1.go +++ b/gcc/testsuite/go.test/test/mallocrep1.go @@ -42,6 +42,7 @@ func AllocAndFree(size, count int) { if *chatty { fmt.Printf("size=%d count=%d ...\n", size, count) } + runtime.UpdateMemStats() n1 := stats.Alloc for i := 0; i < count; i++ { b[i] = runtime.Alloc(uintptr(size)) @@ -50,11 +51,13 @@ func AllocAndFree(size, count int) { println("lookup failed: got", base, n, "for", b[i]) panic("fail") } - if runtime.MemStats.Sys > 1e9 { + runtime.UpdateMemStats() + if stats.Sys > 1e9 { println("too much memory allocated") panic("fail") } } + runtime.UpdateMemStats() n2 := stats.Alloc if *chatty { fmt.Printf("size=%d count=%d stats=%+v\n", size, count, *stats) @@ -72,6 +75,7 @@ func AllocAndFree(size, count int) { panic("fail") } runtime.Free(b[i]) + runtime.UpdateMemStats() if stats.Alloc != uint64(alloc-n) { println("free alloc got", stats.Alloc, "expected", alloc-n, "after free of", n) panic("fail") @@ -81,6 +85,7 @@ func AllocAndFree(size, count int) { panic("fail") } } + runtime.UpdateMemStats() n4 := stats.Alloc if *chatty { |