aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-09-21 13:48:23 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-09-27 20:58:24 +0000
commit6c163e5ac9cdb258566f1287de7915a2fd30a0de (patch)
tree88b75c49a5012c99d4f1e3885119eaed3482d16c /src/runtime/runtime2.go
parente54843f2f4c3b11b52b691eaa187871fb4355d4c (diff)
downloadgo-6c163e5ac9cdb258566f1287de7915a2fd30a0de.tar.xz
runtime: change funcinl sentinel value from 0 to ^0
_func and funcinl are type-punned. We distinguish them at runtime by inspecting the first word. Prior to this change, we used 0 as the sentinel value that means that a Func is a funcinl. That worked because _func's first word is the functions' entry PC, and 0 is not a valid PC. I plan to make *_func's entry PC relative to the containing module. As a result, 0 will be a valid value, for the first function in the module. Switch to ^0 as the new sentinel value, which is neither a valid entry PC nor a valid PC offset. Change-Id: I4c718523a083ed6edd57767c3548640681993522 Reviewed-on: https://go-review.googlesource.com/c/go/+/351459 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 04bd5cb887..442042eb16 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -879,8 +879,8 @@ type _func struct {
// A *Func can be either a *_func or a *funcinl, and they are distinguished
// by the first uintptr.
type funcinl struct {
- zero uintptr // set to 0 to distinguish from _func
- entry uintptr // entry of the real (the "outermost") frame.
+ ones uintptr // set to ^0 to distinguish from _func
+ entry uintptr // entry of the real (the "outermost") frame
name string
file string
line int