]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: omit stack check for no-frame leafs
authorAustin Clements <austin@google.com>
Thu, 25 Jan 2018 18:31:03 +0000 (13:31 -0500)
committerAustin Clements <austin@google.com>
Mon, 12 Feb 2018 21:41:22 +0000 (21:41 +0000)
For leaf functions with zero-sized frames, there's no point in doing a
stack check, so omit it.

This aligns arm64 with other architectures.

Change-Id: I1fb483d62f1736af10c5110815d3f5a875a46d7f
Reviewed-on: https://go-review.googlesource.com/92037
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/internal/obj/arm64/obj7.go

index 709223223f33d7a62ce46be4bbdc6a1cf40cde57..71cee60259ab3813e6584b4a3c1f2246645aea3c 100644 (file)
@@ -552,6 +552,13 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
                                c.cursym.Func.Text.Mark |= LEAF
                        }
 
+                       if c.cursym.Func.Text.Mark&LEAF != 0 {
+                               c.cursym.Set(obj.AttrLeaf, true)
+                               if c.autosize == 0 {
+                                       break
+                               }
+                       }
+
                        if !p.From.Sym.NoSplit() {
                                p = c.stacksplit(p, c.autosize) // emit split check
                        }
@@ -560,12 +567,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
                        if aoffset > 0xF0 {
                                aoffset = 0xF0
                        }
-                       if c.cursym.Func.Text.Mark&LEAF != 0 {
-                               c.cursym.Set(obj.AttrLeaf, true)
-                               if c.autosize == 0 {
-                                       break
-                               }
-                       }
 
                        // Frame is non-empty. Make sure to save link register, even if
                        // it is a leaf function, so that traceback works.