mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: Delete Link.Symmorestack
This started out as trying to remove Bool2int calls, which it does a bit, but mostly it ended up being removing the Link.Symmorestack array which seemed a pointless bit of caching. Change-Id: I91a51eb08cb4b08f3f9f093b575306499267b67a Reviewed-on: https://go-review.googlesource.com/9239 Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
da11a9dda3
commit
4b23b50fb4
5 changed files with 20 additions and 32 deletions
|
|
@ -180,11 +180,6 @@ func linkcase(casep *obj.Prog) {
|
||||||
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
autosize := int32(0)
|
autosize := int32(0)
|
||||||
|
|
||||||
if ctxt.Symmorestack[0] == nil {
|
|
||||||
ctxt.Symmorestack[0] = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
|
||||||
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
ctxt.Cursym = cursym
|
ctxt.Cursym = cursym
|
||||||
|
|
||||||
if cursym.Text == nil || cursym.Text.Link == nil {
|
if cursym.Text == nil || cursym.Text.Link == nil {
|
||||||
|
|
@ -367,7 +362,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.From3.Offset&obj.NOSPLIT == 0 {
|
if p.From3.Offset&obj.NOSPLIT == 0 {
|
||||||
p = stacksplit(ctxt, p, autosize, cursym.Text.From3.Offset&obj.NEEDCTXT == 0) // emit split check
|
p = stacksplit(ctxt, p, autosize) // emit split check
|
||||||
}
|
}
|
||||||
|
|
||||||
// MOVW.W R14,$-autosize(SP)
|
// MOVW.W R14,$-autosize(SP)
|
||||||
|
|
@ -718,7 +713,7 @@ func softfloat(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool) *obj.Prog {
|
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
||||||
// MOVW g_stackguard(g), R1
|
// MOVW g_stackguard(g), R1
|
||||||
p = obj.Appendp(ctxt, p)
|
p = obj.Appendp(ctxt, p)
|
||||||
|
|
||||||
|
|
@ -828,8 +823,10 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool) *obj.
|
||||||
p.To.Type = obj.TYPE_BRANCH
|
p.To.Type = obj.TYPE_BRANCH
|
||||||
if ctxt.Cursym.Cfunc != 0 {
|
if ctxt.Cursym.Cfunc != 0 {
|
||||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
||||||
|
} else if ctxt.Cursym.Text.From3.Offset&obj.NEEDCTXT == 0 {
|
||||||
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
||||||
} else {
|
} else {
|
||||||
p.To.Sym = ctxt.Symmorestack[obj.Bool2int(noctxt)]
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BLS start
|
// BLS start
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ var complements = []int16{
|
||||||
ACMNW: ACMPW,
|
ACMNW: ACMPW,
|
||||||
}
|
}
|
||||||
|
|
||||||
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt int) *obj.Prog {
|
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
||||||
// MOV g_stackguard(g), R1
|
// MOV g_stackguard(g), R1
|
||||||
p = obj.Appendp(ctxt, p)
|
p = obj.Appendp(ctxt, p)
|
||||||
|
|
||||||
|
|
@ -186,8 +186,10 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt int) *obj.P
|
||||||
p.To.Type = obj.TYPE_BRANCH
|
p.To.Type = obj.TYPE_BRANCH
|
||||||
if ctxt.Cursym.Cfunc != 0 {
|
if ctxt.Cursym.Cfunc != 0 {
|
||||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
||||||
|
} else if ctxt.Cursym.Text.From3.Offset&obj.NEEDCTXT == 0 {
|
||||||
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
||||||
} else {
|
} else {
|
||||||
p.To.Sym = ctxt.Symmorestack[noctxt]
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// B start
|
// B start
|
||||||
|
|
@ -465,11 +467,6 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
if ctxt.Symmorestack[0] == nil {
|
|
||||||
ctxt.Symmorestack[0] = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
|
||||||
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
ctxt.Cursym = cursym
|
ctxt.Cursym = cursym
|
||||||
|
|
||||||
if cursym.Text == nil || cursym.Text.Link == nil {
|
if cursym.Text == nil || cursym.Text.Link == nil {
|
||||||
|
|
@ -583,7 +580,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !(p.From3.Offset&obj.NOSPLIT != 0) {
|
if !(p.From3.Offset&obj.NOSPLIT != 0) {
|
||||||
p = stacksplit(ctxt, p, ctxt.Autosize, obj.Bool2int(cursym.Text.From3.Offset&obj.NEEDCTXT == 0)) // emit split check
|
p = stacksplit(ctxt, p, ctxt.Autosize) // emit split check
|
||||||
}
|
}
|
||||||
|
|
||||||
aoffset = ctxt.Autosize
|
aoffset = ctxt.Autosize
|
||||||
|
|
|
||||||
|
|
@ -472,7 +472,6 @@ type Link struct {
|
||||||
Sym_divu *LSym
|
Sym_divu *LSym
|
||||||
Sym_mod *LSym
|
Sym_mod *LSym
|
||||||
Sym_modu *LSym
|
Sym_modu *LSym
|
||||||
Symmorestack [2]*LSym
|
|
||||||
Tlsg *LSym
|
Tlsg *LSym
|
||||||
Plan9privates *LSym
|
Plan9privates *LSym
|
||||||
Curp *Prog
|
Curp *Prog
|
||||||
|
|
|
||||||
|
|
@ -115,11 +115,6 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
if ctxt.Symmorestack[0] == nil {
|
|
||||||
ctxt.Symmorestack[0] = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
|
||||||
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(minux): add morestack short-cuts with small fixed frame-size.
|
// TODO(minux): add morestack short-cuts with small fixed frame-size.
|
||||||
ctxt.Cursym = cursym
|
ctxt.Cursym = cursym
|
||||||
|
|
||||||
|
|
@ -328,7 +323,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
p.To.Offset = int64(autosize) - 8
|
p.To.Offset = int64(autosize) - 8
|
||||||
|
|
||||||
if p.From3.Offset&obj.NOSPLIT == 0 {
|
if p.From3.Offset&obj.NOSPLIT == 0 {
|
||||||
p = stacksplit(ctxt, p, autosize, cursym.Text.From3.Offset&obj.NEEDCTXT == 0) // emit split check
|
p = stacksplit(ctxt, p, autosize) // emit split check
|
||||||
}
|
}
|
||||||
|
|
||||||
q = p
|
q = p
|
||||||
|
|
@ -628,7 +623,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
q = p;
|
q = p;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool) *obj.Prog {
|
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
||||||
// MOVD g_stackguard(g), R3
|
// MOVD g_stackguard(g), R3
|
||||||
p = obj.Appendp(ctxt, p)
|
p = obj.Appendp(ctxt, p)
|
||||||
|
|
||||||
|
|
@ -757,8 +752,10 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool) *obj.
|
||||||
p.To.Type = obj.TYPE_BRANCH
|
p.To.Type = obj.TYPE_BRANCH
|
||||||
if ctxt.Cursym.Cfunc != 0 {
|
if ctxt.Cursym.Cfunc != 0 {
|
||||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
||||||
|
} else if ctxt.Cursym.Text.From3.Offset&obj.NEEDCTXT == 0 {
|
||||||
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
||||||
} else {
|
} else {
|
||||||
p.To.Sym = ctxt.Symmorestack[obj.Bool2int(noctxt)]
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BR start
|
// BR start
|
||||||
|
|
|
||||||
|
|
@ -449,10 +449,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
if ctxt.Tlsg == nil {
|
if ctxt.Tlsg == nil {
|
||||||
ctxt.Tlsg = obj.Linklookup(ctxt, "runtime.tlsg", 0)
|
ctxt.Tlsg = obj.Linklookup(ctxt, "runtime.tlsg", 0)
|
||||||
}
|
}
|
||||||
if ctxt.Symmorestack[0] == nil {
|
|
||||||
ctxt.Symmorestack[0] = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
|
||||||
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ctxt.Headtype == obj.Hplan9 && ctxt.Plan9privates == nil {
|
if ctxt.Headtype == obj.Hplan9 && ctxt.Plan9privates == nil {
|
||||||
ctxt.Plan9privates = obj.Linklookup(ctxt, "_privates", 0)
|
ctxt.Plan9privates = obj.Linklookup(ctxt, "_privates", 0)
|
||||||
|
|
@ -514,7 +510,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
|
|
||||||
var q *obj.Prog
|
var q *obj.Prog
|
||||||
if cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
|
if cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
|
||||||
p = stacksplit(ctxt, p, autoffset, int32(textarg), cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check
|
p = stacksplit(ctxt, p, autoffset, int32(textarg), &q) // emit split check
|
||||||
}
|
}
|
||||||
|
|
||||||
if autoffset != 0 {
|
if autoffset != 0 {
|
||||||
|
|
@ -871,7 +867,7 @@ func load_g_cx(ctxt *obj.Link, p *obj.Prog) *obj.Prog {
|
||||||
// Returns last new instruction.
|
// Returns last new instruction.
|
||||||
// On return, *jmpok is the instruction that should jump
|
// On return, *jmpok is the instruction that should jump
|
||||||
// to the stack frame allocation if no split is needed.
|
// to the stack frame allocation if no split is needed.
|
||||||
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, textarg int32, noctxt bool, jmpok **obj.Prog) *obj.Prog {
|
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, textarg int32, jmpok **obj.Prog) *obj.Prog {
|
||||||
cmp := ACMPQ
|
cmp := ACMPQ
|
||||||
lea := ALEAQ
|
lea := ALEAQ
|
||||||
mov := AMOVQ
|
mov := AMOVQ
|
||||||
|
|
@ -997,8 +993,10 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, textarg int32, noc
|
||||||
p.To.Type = obj.TYPE_BRANCH
|
p.To.Type = obj.TYPE_BRANCH
|
||||||
if ctxt.Cursym.Cfunc != 0 {
|
if ctxt.Cursym.Cfunc != 0 {
|
||||||
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
||||||
|
} else if ctxt.Cursym.Text.From3.Offset&obj.NEEDCTXT == 0 {
|
||||||
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
||||||
} else {
|
} else {
|
||||||
p.To.Sym = ctxt.Symmorestack[obj.Bool2int(noctxt)]
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = obj.Appendp(ctxt, p)
|
p = obj.Appendp(ctxt, p)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue