From 3009566a46f19e9c94df4cf51cc374763698cba0 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Wed, 23 Apr 2025 23:23:53 -0700 Subject: [PATCH] runtime: fix tag pointers on aix Clean up tagged pointers a bit. I got the shifts wrong for the weird aix case. Change-Id: I21449fd5973f4651fd1103d3b8be9c2b9b93a490 Reviewed-on: https://go-review.googlesource.com/c/go/+/667715 Reviewed-by: Michael Knyszek Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI --- src/runtime/malloc.go | 4 ++-- src/runtime/netpoll.go | 2 +- src/runtime/tagptr_64bit.go | 46 +++++++++++-------------------------- 3 files changed, 16 insertions(+), 36 deletions(-) diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 010f20bf94..ffaf92debc 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -455,8 +455,8 @@ func mallocinit() { throw("max pointer/scan bitmap size for headerless objects is too large") } - if minTagBits > taggedPointerBits { - throw("taggedPointerBits too small") + if minTagBits > tagBits { + throw("tagBits too small") } // Initialize the heap. diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go index b2219b92ce..fab921e2d3 100644 --- a/src/runtime/netpoll.go +++ b/src/runtime/netpoll.go @@ -302,7 +302,7 @@ func (c *pollCache) free(pd *pollDesc) { // Increment the fdseq field, so that any currently // running netpoll calls will not mark pd as ready. fdseq := pd.fdseq.Load() - fdseq = (fdseq + 1) & (1< ptr=", t.pointer(), " tag=", hex(t.tag()), "\n") throw("taggedPointerPack") @@ -80,16 +66,10 @@ func (tp taggedPointer) pointer() unsafe.Pointer { // val before unpacking. return unsafe.Pointer(uintptr(int64(tp) >> tagBits << tagAlignBits)) } - if GOOS == "aix" { - return unsafe.Pointer(uintptr((tp >> aixTagBits << tagAlignBits) | 0xa<<56)) - } - if GOARCH == "riscv64" { - return unsafe.Pointer(uintptr(tp >> riscv64TagBits << tagAlignBits)) - } return unsafe.Pointer(uintptr(tp >> tagBits << tagAlignBits)) } // Tag returns the tag from a taggedPointer. func (tp taggedPointer) tag() uintptr { - return uintptr(tp & (1<