]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: revise block/func end sentinels in debug analysis
authorThan McIntosh <thanm@google.com>
Wed, 28 Apr 2021 22:26:54 +0000 (18:26 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 30 Apr 2021 18:46:51 +0000 (18:46 +0000)
commitafa58ddf5a17a3618a24baf161b06cf0e066cb88
tree4054cb1b643bc5ac4ca4e4b4fce87e5c66d21494
parent83ac59b1a55a4ae728393b445e2d2438f930b767
cmd/compile: revise block/func end sentinels in debug analysis

The SSA code for debug variable location analysis (for DWARF) has two
special 'sentinel' values that it uses to handshake with the
debugInfo.GetPC callback when capturing the PC values of debug
variable ranges after prog generatoin: "BlockStart" and "BlockEnd".

"BlockStart" has the expected semantics: it means "the PC value of the
first instruction of block B", but "BlockEnd" does not mean "PC value
of the last instruction of block B", but rather it is implemented as
"the PC value of the last instruction of the function". This causes
confusion when reading the code, and seems to to result in implementation
flaws in the past, leading to incorrect ranges in some cases.

To help with this, add a new sentinel "FuncEnd" (which has the "last
inst in the function" semantics) and change the implementation of
"BlockEnd" to actually mean what its name implies (last inst in
block).

Updates #45720.

Change-Id: Ic3497fb60413e898d2bfe27805c3db56483d12a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/314930
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/debug.go
src/cmd/compile/internal/ssagen/ssa.go