1
0
mirror of https://github.com/golang/go synced 2024-10-01 01:18:32 -06:00

cmd/internal/obj: mark unspill code in prologue preemptible

The UnspillReg code should always be preemptible because all the arg registers will be saved by runtime.asyncpreempt.

Change-Id: Ie36b5d0cdd1275efcb95661354d83be2e1b00a86
Reviewed-on: https://go-review.googlesource.com/c/go/+/526235
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
zhouguangyuan 2023-09-07 00:09:31 +08:00 committed by Cherry Mui
parent 527b6bbac1
commit 2b3c1c5937
4 changed files with 13 additions and 9 deletions

View File

@ -289,11 +289,12 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
}
call.To.Sym = c.ctxt.Lookup(morestack)
unspill := c.cursym.Func().UnspillRegisterArgs(call, c.newprog)
pcdata = c.ctxt.EndUnsafePoint(unspill, c.newprog, -1)
// The instructions which unspill regs should be preemptible.
pcdata = c.ctxt.EndUnsafePoint(call, c.newprog, -1)
unspill := c.cursym.Func().UnspillRegisterArgs(pcdata, c.newprog)
// B start
jmp := obj.Appendp(pcdata, c.newprog)
jmp := obj.Appendp(unspill, c.newprog)
jmp.As = AB
jmp.To.Type = obj.TYPE_BRANCH
jmp.To.SetTarget(startPred.Link)

View File

@ -1363,11 +1363,12 @@ func (c *ctxt9) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
p.To.Reg = REG_R2
}
// The instructions which unspill regs should be preemptible.
p = c.ctxt.EndUnsafePoint(p, c.newprog, -1)
unspill := c.cursym.Func().UnspillRegisterArgs(p, c.newprog)
p = c.ctxt.EndUnsafePoint(unspill, c.newprog, -1)
// BR start
p = obj.Appendp(p, c.newprog)
p = obj.Appendp(unspill, c.newprog)
p.As = ABR
p.To.Type = obj.TYPE_BRANCH
p.To.SetTarget(startPred.Link)

View File

@ -913,8 +913,9 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, cursym *obj.LSym, newprog obj.ProgA
}
jalToSym(ctxt, p, REG_X5)
p = cursym.Func().UnspillRegisterArgs(p, newprog)
// The instructions which unspill regs should be preemptible.
p = ctxt.EndUnsafePoint(p, newprog, -1)
p = cursym.Func().UnspillRegisterArgs(p, newprog)
// JMP start
p = obj.Appendp(p, newprog)

View File

@ -1226,10 +1226,11 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA
progedit(ctxt, callend.Link, newprog)
}
pcdata = cursym.Func().UnspillRegisterArgs(callend, newprog)
pcdata = ctxt.EndUnsafePoint(pcdata, newprog, -1)
// The instructions which unspill regs should be preemptible.
pcdata = ctxt.EndUnsafePoint(callend, newprog, -1)
unspill := cursym.Func().UnspillRegisterArgs(pcdata, newprog)
jmp := obj.Appendp(pcdata, newprog)
jmp := obj.Appendp(unspill, newprog)
jmp.As = obj.AJMP
jmp.To.Type = obj.TYPE_BRANCH
jmp.To.SetTarget(startPred.Link)