Skip to content

Commit

Permalink
cmd/internal/obj: set morestack arg spilling and regabi prologue on l…
Browse files Browse the repository at this point in the history
…oong64

Update #40724

Co-authored-by: Xiaolin Zhao <[email protected]>
Change-Id: Ie92da57e29bae0e5cccb2a49a7cbeaf02cbf3a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/521787
Reviewed-by: Meidan Li <[email protected]>
Run-TryBot: David Chase <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
Reviewed-by: David Chase <[email protected]>
Auto-Submit: David Chase <[email protected]>
  • Loading branch information
2 people authored and gopherbot committed Nov 21, 2023
1 parent c83b5fe commit e58c9ba
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cmd/internal/obj/loong64/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {

p = c.ctxt.StartUnsafePoint(p, c.newprog)

// Spill Arguments. This has to happen before we open
// any more frame space.
p = c.cursym.Func().SpillRegisterArgs(p, c.newprog)

// MOV REGLINK, -8/-16(SP)
p = obj.Appendp(p, c.newprog)
p.As = mov
Expand Down Expand Up @@ -684,6 +688,8 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
p.To.Reg = REGSP
p.Spadj = int32(-frameSize)

// Unspill arguments
p = c.cursym.Func().UnspillRegisterArgs(p, c.newprog)
p = c.ctxt.EndUnsafePoint(p, c.newprog, -1)
}

Expand Down Expand Up @@ -795,6 +801,10 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {

p = c.ctxt.EmitEntryStackMap(c.cursym, p, c.newprog)

// Spill the register args that could be clobbered by the
// morestack code
p = c.cursym.Func().SpillRegisterArgs(p, c.newprog)

// JAL runtime.morestack(SB)
p = obj.Appendp(p, c.newprog)

Expand All @@ -809,6 +819,7 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
}
p.Mark |= BRANCH

p = c.cursym.Func().UnspillRegisterArgs(p, c.newprog)
p = c.ctxt.EndUnsafePoint(p, c.newprog, -1)

// JMP start
Expand Down

0 comments on commit e58c9ba

Please sign in to comment.