diff options
author | Keith Randall <khr@google.com> | 2019-03-25 12:34:27 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2019-03-25 20:46:35 +0000 |
commit | db16de920370892b0241d3fa0617dddff2417a4d (patch) | |
tree | 3a85666fe3b1d1d16dc457ae286e4f133e0c1ce0 /src/runtime/cgocheck.go | |
parent | 501632339f36e7e836ec94958351cee51ee76461 (diff) | |
download | go-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/cgocheck.go')
-rw-r--r-- | src/runtime/cgocheck.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/cgocheck.go b/src/runtime/cgocheck.go index 7f3c4aa803..ed854e5e2b 100644 --- a/src/runtime/cgocheck.go +++ b/src/runtime/cgocheck.go @@ -64,7 +64,7 @@ func cgoCheckWriteBarrier(dst *uintptr, src uintptr) { //go:nosplit //go:nowritebarrier func cgoCheckMemmove(typ *_type, dst, src unsafe.Pointer, off, size uintptr) { - if typ.kind&kindNoPointers != 0 { + if typ.ptrdata == 0 { return } if !cgoIsGoPointer(src) { @@ -83,7 +83,7 @@ func cgoCheckMemmove(typ *_type, dst, src unsafe.Pointer, off, size uintptr) { //go:nosplit //go:nowritebarrier func cgoCheckSliceCopy(typ *_type, dst, src slice, n int) { - if typ.kind&kindNoPointers != 0 { + if typ.ptrdata == 0 { return } if !cgoIsGoPointer(src.array) { @@ -203,7 +203,7 @@ func cgoCheckBits(src unsafe.Pointer, gcbits *byte, off, size uintptr) { //go:nowritebarrier //go:systemstack func cgoCheckUsingType(typ *_type, src unsafe.Pointer, off, size uintptr) { - if typ.kind&kindNoPointers != 0 { + if typ.ptrdata == 0 { return } |