Commit 9c269e6a authored by Keith Randall's avatar Keith Randall

cmd/compile: don't free the Prog list if we look at it after flush

Only tests do this, provide them a hook to disable freeing
after flush.

Change-Id: I810c6c51414a93f476a18ba07b807e16092bf8cf
Reviewed-on: https://go-review.googlesource.com/19907Reviewed-by: 's avatarKeith Randall <khr@golang.org>
parent a9581e2e
......@@ -179,7 +179,7 @@ Diff:
t.Errorf(format, args...)
ok = false
}
obj.Flushplist(ctxt)
obj.FlushplistNoFree(ctxt)
for p := top; p != nil; p = p.Link {
if p.As == obj.ATEXT {
......
......@@ -116,6 +116,12 @@ func Writeobjdirect(ctxt *Link, b *Biobuf) {
}
func Flushplist(ctxt *Link) {
flushplist(ctxt, true)
}
func FlushplistNoFree(ctxt *Link) {
flushplist(ctxt, false)
}
func flushplist(ctxt *Link, freeProgs bool) {
var flag int
var s *LSym
var p *Prog
......@@ -318,7 +324,9 @@ func Flushplist(ctxt *Link) {
ctxt.Plist = nil
ctxt.Plast = nil
ctxt.Curp = nil
ctxt.freeProgs()
if freeProgs {
ctxt.freeProgs()
}
}
func Writeobjfile(ctxt *Link, b *Biobuf) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment