diff options
| author | Keith Randall <khr@golang.org> | 2025-05-05 10:51:52 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-05-05 13:08:27 -0700 |
| commit | fa2bb342d7b0024440d996c2d6d6778b7a5e0247 (patch) | |
| tree | c64fe4b39f32fbca02ee89e22f54fb9e991a828c /src/cmd/internal/obj/arm | |
| parent | 6729fbe93e535080e9e050b3ca0a80ab407dbacc (diff) | |
| download | go-fa2bb342d7b0024440d996c2d6d6778b7a5e0247.tar.xz | |
Revert "cmd/compile: allow all of the preamble to be preemptible"
This reverts commits
3f3782feed6e0726ddb08afd32dad7d94fbb38c6 (CL 648518)
b386b628521780c048af14a148f373c84e687b26 (CL 668475)
Fixes #73542
Change-Id: I218851c5c0b62700281feb0b3f82b6b9b97b910d
Reviewed-on: https://go-review.googlesource.com/c/go/+/670055
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/cmd/internal/obj/arm')
| -rw-r--r-- | src/cmd/internal/obj/arm/obj5.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/cmd/internal/obj/arm/obj5.go b/src/cmd/internal/obj/arm/obj5.go index a975d8a1b3..2f04fd7316 100644 --- a/src/cmd/internal/obj/arm/obj5.go +++ b/src/cmd/internal/obj/arm/obj5.go @@ -703,6 +703,12 @@ func (c *ctxt5) stacksplit(p *obj.Prog, framesize int32) *obj.Prog { p.To.Type = obj.TYPE_REG p.To.Reg = REG_R1 + // Mark the stack bound check and morestack call async nonpreemptible. + // If we get preempted here, when resumed the preemption request is + // cleared, but we'll still call morestack, which will double the stack + // unnecessarily. See issue #35470. + p = c.ctxt.StartUnsafePoint(p, c.newprog) + if framesize <= abi.StackSmall { // small stack: SP < stackguard // CMP stackguard, SP @@ -766,6 +772,8 @@ func (c *ctxt5) stacksplit(p *obj.Prog, framesize int32) *obj.Prog { bls.As = ABLS bls.To.Type = obj.TYPE_BRANCH + end := c.ctxt.EndUnsafePoint(bls, c.newprog, -1) + var last *obj.Prog for last = c.cursym.Func().Text; last.Link != nil; last = last.Link { } @@ -778,6 +786,7 @@ func (c *ctxt5) stacksplit(p *obj.Prog, framesize int32) *obj.Prog { spfix.Spadj = -framesize pcdata := c.ctxt.EmitEntryStackMap(c.cursym, spfix, c.newprog) + pcdata = c.ctxt.StartUnsafePoint(pcdata, c.newprog) // MOVW LR, R3 movw := obj.Appendp(pcdata, c.newprog) @@ -802,14 +811,16 @@ func (c *ctxt5) stacksplit(p *obj.Prog, framesize int32) *obj.Prog { } call.To.Sym = c.ctxt.Lookup(morestack) + pcdata = c.ctxt.EndUnsafePoint(call, c.newprog, -1) + // B start - b := obj.Appendp(call, c.newprog) + b := obj.Appendp(pcdata, c.newprog) b.As = obj.AJMP b.To.Type = obj.TYPE_BRANCH b.To.SetTarget(startPred.Link) b.Spadj = +framesize - return bls + return end } var unaryDst = map[obj.As]bool{ |
