go/src/cmd/compile/internal
Russ Cox 4dd77bdc91 cmd/asm, cmd/link, runtime: introduce FuncInfo flag bits
The runtime traceback code has its own definition of which functions
mark the top frame of a stack, separate from the TOPFRAME bits that
exist in the assembly and are passed along in DWARF information.
It's error-prone and redundant to have two different sources of truth.
This CL provides the actual TOPFRAME bits to the runtime, so that
the runtime can use those bits instead of reinventing its own category.

This CL also adds a new bit, SPWRITE, which marks functions that
write directly to SP (anything but adding and subtracting constants).
Such functions must stop a traceback, because the traceback has no
way to rederive the SP on entry. Again, the runtime has its own definition
which is mostly correct, but also missing some functions. During ordinary
goroutine context switches, such functions do not appear on the stack,
so the incompleteness in the runtime usually doesn't matter.
But profiling signals can arrive at any moment, and the runtime may
crash during traceback if it attempts to unwind an SP-writing frame
and gets out-of-sync with the actual stack. The runtime contains code
to try to detect likely candidates but again it is incomplete.
Deriving the SPWRITE bit automatically from the actual assembly code
provides the complete truth, and passing it to the runtime lets the
runtime use it.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I227f53b23ac5b3dabfcc5e8ee3f00df4e113cf58
Reviewed-on: https://go-review.googlesource.com/c/go/+/288800
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:02:30 +00:00
..
abi [dev.regabi] cmd/compile: modify abiutils for recently updated ABI 2021-01-25 15:56:52 +00:00
amd64 [dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64 2021-02-08 16:30:07 +00:00
arm [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
arm64 [dev.regabi] all: merge master (dab3e5a) into dev.regabi 2021-01-22 12:01:13 -08:00
base [dev.regabi] cmd/compile: refactor Linksym creation 2021-01-19 02:41:42 +00:00
bitvec [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames 2021-01-16 02:31:08 +00:00
deadcode [dev.regabi] cmd/compile: add ir.TailCallStmt 2021-01-17 11:14:51 +00:00
devirtualize [dev.regabi] cmd/compile: cleanup devirtualization docs 2020-12-25 00:39:43 +00:00
dwarfgen [dev.regabi] cmd/compile: backport changes from dev.typeparams (9456804) 2021-01-25 01:31:37 +00:00
escape [dev.regabi] cmd/compile: fix escape analysis problem with closures 2021-01-23 02:15:24 +00:00
gc cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD 2021-02-10 22:44:54 +00:00
inline [dev.regabi] cmd/compile: scan body of closure in tooHairy to check for disallowed nodes 2021-01-23 00:30:58 +00:00
ir [dev.regabi] cmd/compile: remove CallExpr.Rargs 2021-01-21 06:38:25 +00:00
liveness [dev.regabi] cmd/compile: move stack objects to liveness 2021-01-18 06:33:56 +00:00
logopt [dev.regabi] cmd/compile: remove toolstash scaffolding 2021-01-05 21:44:30 +00:00
mips [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
mips64 [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
noder [dev.regabi] cmd/compile: enable rational constant arithmetic 2021-01-25 18:53:24 +00:00
objw [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames 2021-01-16 02:31:08 +00:00
pkginit [dev.regabi] all: merge master (dab3e5a) into dev.regabi 2021-01-22 12:01:13 -08:00
ppc64 [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
reflectdata [dev.regabi] cmd/compile: backport changes from dev.typeparams (9456804) 2021-01-25 01:31:37 +00:00
riscv64 [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
s390x [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
ssa [dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64 2021-02-08 16:30:07 +00:00
ssagen [dev.regabi] cmd/compile: reserve X15 as zero register on AMD64 2021-02-03 22:44:53 +00:00
staticdata [dev.regabi] all: merge master (dab3e5a) into dev.regabi 2021-01-22 12:01:13 -08:00
staticinit [dev.regabi] cmd/compile: use LinksymOffsetExpr in TypePtr/ItabAddr 2021-01-18 04:52:51 +00:00
syntax [dev.regabi] cmd/compile: cleanup //go:generate directives 2020-12-29 02:28:24 +00:00
test cmd/asm, cmd/link, runtime: introduce FuncInfo flag bits 2021-02-19 00:02:30 +00:00
typebits [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames 2021-01-16 02:31:08 +00:00
typecheck [dev.regabi] cmd/compile: enable rational constant arithmetic 2021-01-25 18:53:24 +00:00
types [dev.regabi] cmd/compile: backport changes from dev.typeparams (9456804) 2021-01-25 01:31:37 +00:00
walk [dev.regabi] all: merge master (ff0e93e) into dev.regabi 2021-02-12 16:35:21 -05:00
wasm [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00
x86 [dev.regabi] cmd/compile: split out package ssagen [generated] 2020-12-23 06:39:29 +00:00