...
1
2
3
4
5 package ssa
6
7 import (
8 "cmd/internal/obj"
9 "sort"
10 )
11
12
13
14 type Cache struct {
15
16 values [2000]Value
17 blocks [200]Block
18 locs [2000]Location
19
20
21
22 stackAllocState *stackAllocState
23
24 scrPoset []*poset
25
26
27 regallocValues []valState
28
29 ValueToProgAfter []*obj.Prog
30 debugState debugState
31
32 Liveness interface{}
33
34
35
36 hdrValueSlice []*[]*Value
37 hdrInt64Slice []*[]int64
38 }
39
40 func (c *Cache) Reset() {
41 nv := sort.Search(len(c.values), func(i int) bool { return c.values[i].ID == 0 })
42 xv := c.values[:nv]
43 for i := range xv {
44 xv[i] = Value{}
45 }
46 nb := sort.Search(len(c.blocks), func(i int) bool { return c.blocks[i].ID == 0 })
47 xb := c.blocks[:nb]
48 for i := range xb {
49 xb[i] = Block{}
50 }
51 nl := sort.Search(len(c.locs), func(i int) bool { return c.locs[i] == nil })
52 xl := c.locs[:nl]
53 for i := range xl {
54 xl[i] = nil
55 }
56
57
58
59 for i := range c.regallocValues {
60 c.regallocValues[i] = valState{}
61 }
62 }
63
View as plain text