support Go1.27 linkname mode - #101
Conversation
There was a problem hiding this comment.
Review: Add Go 1.27 support
Solid, well-scoped change that follows the existing version-gated pattern: the new internal/abi/map_go127.go mirrors the 1.27 swissmap MapType layout, map_swiss.go/map_go124.go gain the !go1.27 upper bound, and cloneMap is split correctly. The cloneMap field set in map_go127.go matches the new struct and drops the 1.24-only SlotSize — good.
One build-tag defect blocks the llgo path, and a couple of minor items below.
Author verification requested (cannot be checked from the diff): the MapType layout in internal/abi/map_go127.go is unsafe.Pointer-cast over the real Go 1.27 runtime internal/abi map type (via type mapType = abi.MapType, used in rtype.go:65). Since the 1.27 CI runs with -ldflags=-checklinkname=0, the toolchain will not catch a layout mismatch — a wrong field order/set would silently corrupt memory. Please confirm the field order Key, Elem, Group, Hasher, GroupSize, KeysOff, KeyStride, ElemsOff, ElemStride, ElemOff, Flags byte-for-byte against the pinned Go 1.27 source, including whether both ElemsOff and ElemOff coexist.
| // Use of this source code is governed by a BSD-style | ||
| // license that can be found in the LICENSE file. | ||
|
|
||
| //go:build go1.27 |
There was a problem hiding this comment.
[P1] Missing !llgo in build tag breaks llgo + Go 1.27 build
The build tag is //go:build go1.27 (no !llgo). But internal/abi/type_llgo.go (//go:build llgo) also declares MapType and the methods NeedKeyUpdate()/HashMightPanic(). Under llgo && go1.27 both files compile, producing MapType redeclared / method NeedKeyUpdate redeclared errors.
Every sibling guards against this: map_swiss.go and map_noswiss.go both include !llgo, and the reflectx-level map_go127.go uses go1.27 && !llgo. Change this tag to:
//go:build go1.27 && !llgo| ### Go Version | ||
|
|
||
| - Go 1.21 ~ 1.26 | ||
| - Go 1.27 ([linkname mode](#build-linkname-mode)) |
There was a problem hiding this comment.
[P3] Stray full-width parenthesis after README link
The line ends with an ASCII ) closing the Markdown link followed by a stray full-width ) (U+FF09), which renders as literal text after the link. The anchor #build-linkname-mode itself resolves correctly to the #### build linkname mode heading. Replace the trailing ) with an ASCII ) (or drop it):
- Go 1.27 ([linkname mode](#build-linkname-mode))| KeyStride uintptr | ||
| ElemsOff uintptr | ||
| ElemStride uintptr | ||
| ElemOff uintptr // GOEXPERIMENT=nomapsplitgroup only |
There was a problem hiding this comment.
[P3] ElemOff inline comment not reconciled with struct doc block
The field comment // GOEXPERIMENT=nomapsplitgroup only is not explained by the doc block above (lines 42-56), which describes access only via KeysOff/KeyStride/ElemsOff/ElemStride and never mentions ElemOff. The relationship between ElemOff and ElemsOff is left ambiguous. Consider extending the doc block to state what ElemOff means and in which configuration it is populated, so the field mirror is self-documenting (this matters given the layout must match the runtime exactly).
No description provided.