1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:14:43 -07:00

cmd/compile/internal/ssa: remove Func.StaticData field

Rather than collecting static data nodes to be written out later, just
write them out immediately.

Change-Id: I51708b690e94bc3e288b4d6ba3307bf738a80f64
Reviewed-on: https://go-review.googlesource.com/36352
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Matthew Dempsky 2017-02-03 14:28:32 -08:00
parent 592c97fc8f
commit 5c90e1cf8a
2 changed files with 11 additions and 25 deletions

View File

@ -642,15 +642,11 @@ func (s *state) stmt(n *Node) {
b.AddEdgeTo(lab.target)
case OAS, OASWB:
// Check whether we can generate static data rather than code.
// If so, ignore n and defer data generation until codegen.
// Failure to do this causes writes to readonly symbols.
// Generate static data rather than code, if possible.
if gen_as_init(n, true) {
var data []*Node
if s.f.StaticData != nil {
data = s.f.StaticData.([]*Node)
if !gen_as_init(n, false) {
Fatalf("non-static data marked as static: %v\n\n", n)
}
s.f.StaticData = append(data, n)
return
}
@ -4487,15 +4483,6 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
}
}
// Emit static data
if f.StaticData != nil {
for _, n := range f.StaticData.([]*Node) {
if !gen_as_init(n, false) {
Fatalf("non-static data marked as static: %v\n\n", n)
}
}
}
// Generate gc bitmaps.
liveness(Curfn, ptxt, gcargs, gclocals)

View File

@ -18,7 +18,6 @@ type Func struct {
pass *pass // current pass information (name, options, etc.)
Name string // e.g. bytes·Compare
Type Type // type signature of the function.
StaticData interface{} // associated static data, untouched by the ssa package
Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID)
Entry *Block // the entry basic block
bid idAlloc // block ID allocator