runtime: scan register backing store on ia64
[official-gcc.git] / libgo / go / runtime / closure_test.go
blobea65fbd5f5d72624c89e961b46607dd1db79c544
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4 package runtime_test
6 import "testing"
8 var s int
10 func BenchmarkCallClosure(b *testing.B) {
11 for i := 0; i < b.N; i++ {
12 s += func(ii int) int { return 2 * ii }(i)
16 func BenchmarkCallClosure1(b *testing.B) {
17 for i := 0; i < b.N; i++ {
18 j := i
19 s += func(ii int) int { return 2*ii + j }(i)
23 var ss *int
25 func BenchmarkCallClosure2(b *testing.B) {
26 for i := 0; i < b.N; i++ {
27 j := i
28 s += func() int {
29 ss = &j
30 return 2
31 }()
35 func addr1(x int) *int {
36 return func() *int { return &x }()
39 func BenchmarkCallClosure3(b *testing.B) {
40 for i := 0; i < b.N; i++ {
41 ss = addr1(i)
45 func addr2() (x int, p *int) {
46 return 0, func() *int { return &x }()
49 func BenchmarkCallClosure4(b *testing.B) {
50 for i := 0; i < b.N; i++ {
51 _, ss = addr2()