@@ -163,12 +163,6 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
163163 p .To .Type = obj .TYPE_REG
164164 p .To .Reg = REGRT1
165165
166- // Mark the stack bound check and morestack call async nonpreemptible.
167- // If we get preempted here, when resumed the preemption request is
168- // cleared, but we'll still call morestack, which will double the stack
169- // unnecessarily. See issue #35470.
170- p = c .ctxt .StartUnsafePoint (p , c .newprog )
171-
172166 q := (* obj .Prog )(nil )
173167 if framesize <= abi .StackSmall {
174168 // small stack: SP < stackguard
@@ -235,8 +229,6 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
235229 bls .As = ABLS
236230 bls .To .Type = obj .TYPE_BRANCH
237231
238- end := c .ctxt .EndUnsafePoint (bls , c .newprog , - 1 )
239-
240232 var last * obj.Prog
241233 for last = c .cursym .Func ().Text ; last .Link != nil ; last = last .Link {
242234 }
@@ -249,7 +241,6 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
249241 spfix .Spadj = - framesize
250242
251243 pcdata := c .ctxt .EmitEntryStackMap (c .cursym , spfix , c .newprog )
252- pcdata = c .ctxt .StartUnsafePoint (pcdata , c .newprog )
253244
254245 if q != nil {
255246 q .To .SetTarget (pcdata )
@@ -289,9 +280,7 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
289280 }
290281 call .To .Sym = c .ctxt .Lookup (morestack )
291282
292- // The instructions which unspill regs should be preemptible.
293- pcdata = c .ctxt .EndUnsafePoint (call , c .newprog , - 1 )
294- unspill := c .cursym .Func ().UnspillRegisterArgs (pcdata , c .newprog )
283+ unspill := c .cursym .Func ().UnspillRegisterArgs (call , c .newprog )
295284
296285 // B start
297286 jmp := obj .Appendp (unspill , c .newprog )
@@ -300,7 +289,7 @@ func (c *ctxt7) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
300289 jmp .To .SetTarget (startPred .Link )
301290 jmp .Spadj = + framesize
302291
303- return end
292+ return bls
304293}
305294
306295func progedit (ctxt * obj.Link , p * obj.Prog , newprog obj.ProgAlloc ) {
0 commit comments