...
1
2
3
4
5 package p
6
7
8 type Pointery struct {
9 p *Pointery
10 x [1024]int
11 }
12
13 type Pointery2 struct {
14 p *Pointery2
15 x [1024]int
16 }
17
18
19 type Vanilla struct {
20 np uintptr
21 x [1024]int
22 }
23
24 type Vanilla2 struct {
25 np uintptr
26 x [1023]int
27 y int
28 }
29
30 type Single struct {
31 np uintptr
32 x [1023]int
33 }
34
35 var G int
36
37
38 func clobber() {
39 G++
40 }
41
42 func ABC(i, j int) int {
43 r := 0
44
45
46 clobber()
47 if i < 101 {
48 var v2 Vanilla
49 v2.x[i] = j
50 r += v2.x[j]
51 }
52 if j != 303 {
53 var v3 Vanilla2
54 v3.x[i] = j
55 r += v3.x[j]
56 }
57 clobber()
58
59
60 var s Single
61 s.x[i] = j
62 r += s.x[j]
63
64
65 var p1, p2 Pointery
66 p1.x[i] = j
67 r += p1.x[j]
68 p2.x[i] = j
69 r += p2.x[j]
70 if j != 505 {
71 var xp3 Pointery2
72 xp3.x[i] = j
73 r += xp3.x[j]
74 }
75
76 if i == j*2 {
77
78 p2.x[i] += j
79 r += p2.x[j]
80 } else {
81
82 var xp4 Pointery2
83 xp4.x[i] = j
84 r += xp4.x[j]
85 }
86
87 return r + G
88 }
89
View as plain text