From 9c269e6a46fce4ee19e1603eaa9f5bb78dec78fd Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 24 Feb 2016 14:07:25 -0800 Subject: 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 --- src/cmd/internal/obj/objfile.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/cmd/internal/obj') diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go index 2d5c82376b..6757067dd6 100644 --- a/src/cmd/internal/obj/objfile.go +++ b/src/cmd/internal/obj/objfile.go @@ -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) { -- cgit v1.3-5-g9baa