aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfinal.go
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2019-03-25 12:34:27 -0700
committerKeith Randall <khr@golang.org>2019-03-25 20:46:35 +0000
commitdb16de920370892b0241d3fa0617dddff2417a4d (patch)
tree3a85666fe3b1d1d16dc457ae286e4f133e0c1ce0 /src/runtime/mfinal.go
parent501632339f36e7e836ec94958351cee51ee76461 (diff)
downloadgo-db16de920370892b0241d3fa0617dddff2417a4d.tar.gz
go-db16de920370892b0241d3fa0617dddff2417a4d.zip
runtime: remove kindNoPointers
We already have the ptrdata field in a type, which encodes exactly the same information that kindNoPointers does. My problem with kindNoPointers is that it often leads to double-negative code like: t.kind & kindNoPointers != 0 Much clearer is: t.ptrdata == 0 Update #27167 Change-Id: I92307d7f018a6bbe3daca4a4abb4225e359349b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/169157 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/mfinal.go')
-rw-r--r--src/runtime/mfinal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go
index a8c51e3e02..37b2c381dd 100644
--- a/src/runtime/mfinal.go
+++ b/src/runtime/mfinal.go
@@ -356,7 +356,7 @@ func SetFinalizer(obj interface{}, finalizer interface{}) {
if uintptr(e.data) != base {
// As an implementation detail we allow to set finalizers for an inner byte
// of an object if it could come from tiny alloc (see mallocgc for details).
- if ot.elem == nil || ot.elem.kind&kindNoPointers == 0 || ot.elem.size >= maxTinySize {
+ if ot.elem == nil || ot.elem.ptrdata != 0 || ot.elem.size >= maxTinySize {
throw("runtime.SetFinalizer: pointer not at beginning of allocated block")
}
}