Skip to content

Commit d20e688

Browse files
committed
runtime: remove implicit NOFRAME heuristic support
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 <[email protected]> Run-TryBot: Quim Muntal <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent a5f3cb6 commit d20e688

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/cmd/internal/obj/x86/obj6.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -614,27 +614,15 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
614614
}
615615
}
616616

617-
var usefpheuristic bool
618-
switch ctxt.Headtype {
619-
case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly,
620-
objabi.Hfreebsd, objabi.Hnetbsd, objabi.Hopenbsd, objabi.Hsolaris, objabi.Hplan9:
621-
default:
622-
usefpheuristic = true
623-
}
624-
625617
var bpsize int
626618
if ctxt.Arch.Family == sys.AMD64 &&
627619
!p.From.Sym.NoFrame() && // (1) below
628-
!(autoffset == 0 && p.From.Sym.NoSplit() && usefpheuristic) && // (2) below
629-
!(autoffset == 0 && !hasCall) { // (3) below
620+
!(autoffset == 0 && !hasCall) { // (2) below
630621
// Make room to save a base pointer.
631622
// There are 2 cases we must avoid:
632623
// 1) If noframe is set (which we do for functions which tail call).
633-
// 2) Scary runtime internals which would be all messed up by frame pointers.
634-
// We detect these using a heuristic: frameless nosplit functions.
635-
// TODO: Maybe someday we label them all with NOFRAME and get rid of this heuristic.
636624
// For performance, we also want to avoid:
637-
// 3) Frameless leaf functions
625+
// 2) Frameless leaf functions
638626
bpsize = ctxt.Arch.PtrSize
639627
autoffset += int32(bpsize)
640628
p.To.Offset += int64(bpsize)

src/runtime/textflag.h

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#define TLSBSS 256
2929
// Do not insert instructions to allocate a stack frame for this function.
3030
// Only valid on functions that declare a frame size of 0.
31-
// TODO(mwhudson): only implemented for ppc64x at present.
3231
#define NOFRAME 512
3332
// Function can call reflect.Type.Method or reflect.Type.MethodByName.
3433
#define REFLECTMETHOD 1024

0 commit comments

Comments
 (0)