Commit e518962a authored by Matthew Dempsky's avatar Matthew Dempsky

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: default avatarDave Cheney <dave@cheney.net>
parent fc5df089
......@@ -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 {
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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()
......
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