1
0
mirror of https://github.com/golang/go synced 2024-11-18 14:04:45 -07:00

cmd/internal/obj: simplify Plists

Keep Plists in a slice instead of a linked list.
Eliminate unnecessary fields.
Also, while here remove gc's unused breakpc and continpc vars.

Change-Id: Ia04264036c0442843869965d247ccf68a5295115
Reviewed-on: https://go-review.googlesource.com/29367
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
Matthew Dempsky 2016-09-16 18:31:25 -07:00
parent fc5df089da
commit e518962a27
5 changed files with 5 additions and 25 deletions

View File

@ -1260,8 +1260,6 @@ func funccompile(n *Node) {
compile(n)
Curfn = nil
Pc = nil
continpc = nil
breakpc = nil
funcdepth = 0
dclcontext = PEXTERN
if nerrors != 0 {

View File

@ -274,10 +274,6 @@ var writearchive bool
var Nacl bool
var continpc *obj.Prog
var breakpc *obj.Prog
var Pc *obj.Prog
var nodfp *Node

View File

@ -372,11 +372,7 @@ func compile(fn *Node) {
return
}
continpc = nil
breakpc = nil
pl := newplist()
pl.Name = Linksym(Curfn.Func.Nname.Sym)
newplist()
setlineno(Curfn)

View File

@ -679,8 +679,7 @@ type Link struct {
Hash map[SymVer]*LSym
LineHist LineHist
Imports []string
Plist *Plist
Plast *Plist
Plists []*Plist
Sym_div *LSym
Sym_divu *LSym
Sym_mod *LSym

View File

@ -11,10 +11,7 @@ import (
)
type Plist struct {
Name *LSym
Firstpc *Prog
Recur int
Link *Plist
}
/*
@ -22,12 +19,7 @@ type Plist struct {
*/
func Linknewplist(ctxt *Link) *Plist {
pl := new(Plist)
if ctxt.Plist == nil {
ctxt.Plist = pl
} else {
ctxt.Plast.Link = pl
}
ctxt.Plast = pl
ctxt.Plists = append(ctxt.Plists, pl)
return pl
}
@ -45,7 +37,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
var etext *Prog
var text []*LSym
for pl := ctxt.Plist; pl != nil; pl = pl.Link {
for _, pl := range ctxt.Plists {
var plink *Prog
for p := pl.Firstpc; p != nil; p = plink {
if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 {
@ -182,8 +174,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
// Add to running list in ctxt.
ctxt.Text = append(ctxt.Text, text...)
ctxt.Data = append(ctxt.Data, gendwarf(ctxt, text)...)
ctxt.Plist = nil
ctxt.Plast = nil
ctxt.Plists = nil
ctxt.Curp = nil
if freeProgs {
ctxt.freeProgs()