Skip to content

Commit e58c9ba

Browse files
abner-chencsophie-zhao
authored andcommitted
cmd/internal/obj: set morestack arg spilling and regabi prologue on loong64
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]>
1 parent c83b5fe commit e58c9ba

File tree

1 file changed

+11
-0
lines changed
  • src/cmd/internal/obj/loong64

1 file changed

+11
-0
lines changed

src/cmd/internal/obj/loong64/obj.go

+11
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,10 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
620620

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

623+
// Spill Arguments. This has to happen before we open
624+
// any more frame space.
625+
p = c.cursym.Func().SpillRegisterArgs(p, c.newprog)
626+
623627
// MOV REGLINK, -8/-16(SP)
624628
p = obj.Appendp(p, c.newprog)
625629
p.As = mov
@@ -684,6 +688,8 @@ func (c *ctxt0) stacksplit(p *obj.Prog, framesize int32) *obj.Prog {
684688
p.To.Reg = REGSP
685689
p.Spadj = int32(-frameSize)
686690

691+
// Unspill arguments
692+
p = c.cursym.Func().UnspillRegisterArgs(p, c.newprog)
687693
p = c.ctxt.EndUnsafePoint(p, c.newprog, -1)
688694
}
689695

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

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

804+
// Spill the register args that could be clobbered by the
805+
// morestack code
806+
p = c.cursym.Func().SpillRegisterArgs(p, c.newprog)
807+
798808
// JAL runtime.morestack(SB)
799809
p = obj.Appendp(p, c.newprog)
800810

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

822+
p = c.cursym.Func().UnspillRegisterArgs(p, c.newprog)
812823
p = c.ctxt.EndUnsafePoint(p, c.newprog, -1)
813824

814825
// JMP start

0 commit comments

Comments
 (0)