Skip to content

support Go1.27 linkname mode - #101

Merged
visualfc merged 1 commit into
goplus:mainfrom
visualfc:go1.27
Aug 21, 2026
Merged

support Go1.27 linkname mode#101
visualfc merged 1 commit into
goplus:mainfrom
visualfc:go1.27

Conversation

@visualfc

Copy link
Copy Markdown
Member

No description provided.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/abi/map_go127.go
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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

Comment thread README.md
### Go Version

- Go 1.21 ~ 1.26
- Go 1.27 ([linkname mode](#build-linkname-mode))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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))

Comment thread internal/abi/map_go127.go
KeyStride uintptr
ElemsOff uintptr
ElemStride uintptr
ElemOff uintptr // GOEXPERIMENT=nomapsplitgroup only

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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).

@visualfc
visualfc merged commit 4705be4 into goplus:main Aug 21, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant