]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove implicit NOFRAME heuristic support
authorqmuntal <quimmuntal@gmail.com>
Wed, 8 Feb 2023 15:51:34 +0000 (16:51 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 1 Mar 2023 17:28:41 +0000 (17:28 +0000)
All amd64 OSes already make use of the NOFRAME flag wherever is
required, so we can remove the frameless nosplit functions heuristic
code path.

Updates #58378

Change-Id: I966970693ba07f8c66da0aca83c23caad7cbbfe5
Reviewed-on: https://go-review.googlesource.com/c/go/+/466458
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/internal/obj/x86/obj6.go
src/runtime/textflag.h

index 395a0a791965091654cfe25d3b63f661e6e3d986..fc0a9c44848bfa42cd29d1b72afc7d4ac72dbcaf 100644 (file)
@@ -614,27 +614,15 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
                }
        }
 
-       var usefpheuristic bool
-       switch ctxt.Headtype {
-       case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly,
-               objabi.Hfreebsd, objabi.Hnetbsd, objabi.Hopenbsd, objabi.Hsolaris, objabi.Hplan9:
-       default:
-               usefpheuristic = true
-       }
-
        var bpsize int
        if ctxt.Arch.Family == sys.AMD64 &&
                !p.From.Sym.NoFrame() && // (1) below
-               !(autoffset == 0 && p.From.Sym.NoSplit() && usefpheuristic) && // (2) below
-               !(autoffset == 0 && !hasCall) { // (3) below
+               !(autoffset == 0 && !hasCall) { // (2) below
                // Make room to save a base pointer.
                // There are 2 cases we must avoid:
                // 1) If noframe is set (which we do for functions which tail call).
-               // 2) Scary runtime internals which would be all messed up by frame pointers.
-               //    We detect these using a heuristic: frameless nosplit functions.
-               //    TODO: Maybe someday we label them all with NOFRAME and get rid of this heuristic.
                // For performance, we also want to avoid:
-               // 3) Frameless leaf functions
+               // 2) Frameless leaf functions
                bpsize = ctxt.Arch.PtrSize
                autoffset += int32(bpsize)
                p.To.Offset += int64(bpsize)
index 214075e360ceb623daa53cdd8313cdd5473435af..893031220120c153d9ac8bebed0861deddc3f0ce 100644 (file)
@@ -28,7 +28,6 @@
 #define TLSBSS 256
 // Do not insert instructions to allocate a stack frame for this function.
 // Only valid on functions that declare a frame size of 0.
-// TODO(mwhudson): only implemented for ppc64x at present.
 #define NOFRAME 512
 // Function can call reflect.Type.Method or reflect.Type.MethodByName.
 #define REFLECTMETHOD 1024