]> Cypherpunks repositories - gostls13.git/commit
runtime: change funcinl sentinel value from 0 to ^0
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 21 Sep 2021 20:48:23 +0000 (13:48 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 27 Sep 2021 20:58:24 +0000 (20:58 +0000)
commit6c163e5ac9cdb258566f1287de7915a2fd30a0de
tree88b75c49a5012c99d4f1e3885119eaed3482d16c
parente54843f2f4c3b11b52b691eaa187871fb4355d4c
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>
src/runtime/runtime2.go
src/runtime/symtab.go