Commit 7e817859 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/internal/obj: eliminate Curp

Remove the global obj.Link.Curp.

In asmz.go, replace the only use by passing it as an argument.
In asm0.go and asm9.go, it was written but never read.
In asm5.go and asm7.go, thread it through as an argument.

Passes toolstash-check -all.

Updates #15756

Change-Id: I1a0faa89e768820f35d73a8b37ec8088d78d15f7
Reviewed-on: https://go-review.googlesource.com/38715
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 1acba7d4
This diff is collapsed.
This diff is collapsed.
......@@ -730,7 +730,6 @@ type Link struct {
Sym_mod *LSym
Sym_modu *LSym
Plan9privates *LSym
Curp *Prog
Printp *Prog
Blitrl *Prog
Elitrl *Prog
......
......@@ -391,7 +391,6 @@ func span0(ctxt *obj.Link, cursym *obj.LSym) {
var m int
var o *Optab
for p = p.Link; p != nil; p = p.Link {
ctxt.Curp = p
p.Pc = c
o = oplook(ctxt, p)
m = int(o.size)
......@@ -482,7 +481,6 @@ func span0(ctxt *obj.Link, cursym *obj.LSym) {
var out [4]uint32
for p := cursym.Text.Link; p != nil; p = p.Link {
ctxt.Pc = p.Pc
ctxt.Curp = p
o = oplook(ctxt, p)
if int(o.size) > 4*len(out) {
log.Fatalf("out array in span0 is too small, need at least %d for %v", o.size/4, p)
......
......@@ -136,7 +136,6 @@ func flushplist(ctxt *Link, plist *Plist, freeProgs bool) {
// Add to running list in ctxt.
ctxt.Text = append(ctxt.Text, text...)
ctxt.Curp = nil
if freeProgs {
ctxt.freeProgs()
}
......
......@@ -570,7 +570,6 @@ func span9(ctxt *obj.Link, cursym *obj.LSym) {
var m int
var o *Optab
for p = p.Link; p != nil; p = p.Link {
ctxt.Curp = p
p.Pc = c
o = oplook(ctxt, p)
m = int(o.size)
......@@ -658,7 +657,6 @@ func span9(ctxt *obj.Link, cursym *obj.LSym) {
var out [6]uint32
for p := cursym.Text.Link; p != nil; p = p.Link {
ctxt.Pc = p.Pc
ctxt.Curp = p
o = oplook(ctxt, p)
if int(o.size) > 4*len(out) {
log.Fatalf("out array in span9 is too small, need at least %d for %v", o.size/4, p)
......
......@@ -415,8 +415,7 @@ func spanz(ctxt *obj.Link, cursym *obj.LSym) {
}
p.Pc = pc
ctxt.Pc = p.Pc
ctxt.Curp = p
asmout(ctxt, &buffer)
asmout(ctxt, p, &buffer)
if pc == int64(len(buffer)) {
switch p.As {
case obj.ANOP, obj.AFUNCDATA, obj.APCDATA, obj.ATEXT:
......@@ -2549,8 +2548,7 @@ func branchMask(ctxt *obj.Link, p *obj.Prog) uint32 {
return 0xF
}
func asmout(ctxt *obj.Link, asm *[]byte) {
p := ctxt.Curp
func asmout(ctxt *obj.Link, p *obj.Prog, asm *[]byte) {
o := oplook(ctxt, p)
ctxt.Printp = p
......
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