aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorPouriya <pouriya.jahanbakhsh@gmail.com>2024-02-27 21:51:31 +0000
committerGopher Robot <gobot@golang.org>2024-03-04 17:34:30 +0000
commit4c08c125936b4ae3daff04cecf5309dd5dd1e2c5 (patch)
treefac8b4deb533caf5caaf89b0c12ab777d2c07f39 /src/runtime/malloc.go
parent566e08fc649cb8c65d2a9f0f362ce76d79e0fc4d (diff)
downloadgo-4c08c125936b4ae3daff04cecf5309dd5dd1e2c5.tar.xz
runtime: use .Pointers() instead of manual checking
Change-Id: Ib78c1513616089f4942297cd17212b1b11871fd5 GitHub-Last-Rev: f97fe5b5bffffe25dc31de7964588640cb70ec41 GitHub-Pull-Request: golang/go#65819 Reviewed-on: https://go-review.googlesource.com/c/go/+/565515 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index e2cb2e456e..271e4c43db 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -1043,7 +1043,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
var span *mspan
var header **_type
var x unsafe.Pointer
- noscan := typ == nil || typ.PtrBytes == 0
+ noscan := typ == nil || !typ.Pointers()
// In some cases block zeroing can profitably (for latency reduction purposes)
// be delayed till preemption is possible; delayedZeroing tracks that state.
delayedZeroing := false
@@ -1188,7 +1188,7 @@ func mallocgc(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
// Array allocation. If there are any
// pointers, GC has to scan to the last
// element.
- if typ.PtrBytes != 0 {
+ if typ.Pointers() {
scanSize = dataSize - typ.Size_ + typ.PtrBytes
}
} else {