aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mfinal.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/mfinal.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/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 7d9d547c0f..ea3d8a4579 100644
--- a/src/runtime/mfinal.go
+++ b/src/runtime/mfinal.go
@@ -449,7 +449,7 @@ func SetFinalizer(obj any, finalizer any) {
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.PtrBytes != 0 || ot.Elem.Size_ >= maxTinySize {
+ if ot.Elem == nil || ot.Elem.Pointers() || ot.Elem.Size_ >= maxTinySize {
throw("runtime.SetFinalizer: pointer not at beginning of allocated block")
}
}