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) { ...@@ -1260,8 +1260,6 @@ func funccompile(n *Node) {
compile(n) compile(n)
Curfn = nil Curfn = nil
Pc = nil Pc = nil
continpc = nil
breakpc = nil
funcdepth = 0 funcdepth = 0
dclcontext = PEXTERN dclcontext = PEXTERN
if nerrors != 0 { if nerrors != 0 {
......
...@@ -274,10 +274,6 @@ var writearchive bool ...@@ -274,10 +274,6 @@ var writearchive bool
var Nacl bool var Nacl bool
var continpc *obj.Prog
var breakpc *obj.Prog
var Pc *obj.Prog var Pc *obj.Prog
var nodfp *Node var nodfp *Node
......
...@@ -372,11 +372,7 @@ func compile(fn *Node) { ...@@ -372,11 +372,7 @@ func compile(fn *Node) {
return return
} }
continpc = nil newplist()
breakpc = nil
pl := newplist()
pl.Name = Linksym(Curfn.Func.Nname.Sym)
setlineno(Curfn) setlineno(Curfn)
......
...@@ -679,8 +679,7 @@ type Link struct { ...@@ -679,8 +679,7 @@ type Link struct {
Hash map[SymVer]*LSym Hash map[SymVer]*LSym
LineHist LineHist LineHist LineHist
Imports []string Imports []string
Plist *Plist Plists []*Plist
Plast *Plist
Sym_div *LSym Sym_div *LSym
Sym_divu *LSym Sym_divu *LSym
Sym_mod *LSym Sym_mod *LSym
......
...@@ -11,10 +11,7 @@ import ( ...@@ -11,10 +11,7 @@ import (
) )
type Plist struct { type Plist struct {
Name *LSym
Firstpc *Prog Firstpc *Prog
Recur int
Link *Plist
} }
/* /*
...@@ -22,12 +19,7 @@ type Plist struct { ...@@ -22,12 +19,7 @@ type Plist struct {
*/ */
func Linknewplist(ctxt *Link) *Plist { func Linknewplist(ctxt *Link) *Plist {
pl := new(Plist) pl := new(Plist)
if ctxt.Plist == nil { ctxt.Plists = append(ctxt.Plists, pl)
ctxt.Plist = pl
} else {
ctxt.Plast.Link = pl
}
ctxt.Plast = pl
return pl return pl
} }
...@@ -45,7 +37,7 @@ func flushplist(ctxt *Link, freeProgs bool) { ...@@ -45,7 +37,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
var etext *Prog var etext *Prog
var text []*LSym var text []*LSym
for pl := ctxt.Plist; pl != nil; pl = pl.Link { for _, pl := range ctxt.Plists {
var plink *Prog var plink *Prog
for p := pl.Firstpc; p != nil; p = plink { for p := pl.Firstpc; p != nil; p = plink {
if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 { if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 {
...@@ -182,8 +174,7 @@ func flushplist(ctxt *Link, freeProgs bool) { ...@@ -182,8 +174,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
// Add to running list in ctxt. // Add to running list in ctxt.
ctxt.Text = append(ctxt.Text, text...) ctxt.Text = append(ctxt.Text, text...)
ctxt.Data = append(ctxt.Data, gendwarf(ctxt, text)...) ctxt.Data = append(ctxt.Data, gendwarf(ctxt, text)...)
ctxt.Plist = nil ctxt.Plists = nil
ctxt.Plast = nil
ctxt.Curp = nil ctxt.Curp = nil
if freeProgs { if freeProgs {
ctxt.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