mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
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/19907 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
a9581e2e7a
commit
9c269e6a46
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user