Skip to content

[AUTOMATED] [PROPOSAL] Recover named Go small-map results - #1776

Merged
mahaloz merged 2 commits into
mainfrom
proposal/go-small-map-result
Nov 22, 2026
Merged

mahaloz merged 2 commits into
mainfrom
proposal/go-small-map-result

Conversation

@mahaloz

@mahaloz mahaloz commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Kuna can recover the pointer returned by runtime.makemap_small but leave its source map type unstated.

d=$(mktemp -d)
cat >"$d/main.go" <<'GO'
package main
type Key uint32
type Value uint64
type Registry map[Key]Value
//go:noinline
func NewRegistry() Registry { return make(Registry) }
//go:noinline
func WithHint(n int) Registry { return make(Registry, n) }
var x, y Registry
func main() { x, y = NewRegistry(), WithHint(32) }
GO
CGO_ENABLED=0 go build -trimpath -o "$d/maps" "$d/main.go"
chmod a-x "$d/maps"
kuna decompile "$d/maps" main.NewRegistry --language go \
  --sleighpath "${KUNA_SPECS:-specs}"

Go 1.22.10 on Linux AMD64 gives func NewRegistry() uint64 and return runtime.makemap_small().

The proposal keeps one allocation and its full returned pointer. It prints return make(Registry) only when the declared result and runtime type identity agree. The acceptance cases check fresh independent maps, raw lookalikes, explicit declarations and wrappers with other effects.

mahaloz and others added 2 commits November 19, 2026 11:04
Propose a typed result for a verified standalone small-map allocation.
…apper today

The batched result loss no longer reproduces on 760a27b; the remaining gap is the
source map type.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
@mahaloz
mahaloz marked this pull request as ready for review November 22, 2026 22:22
@mahaloz
mahaloz merged commit 15f125b into main Nov 22, 2026
9 checks passed
@mahaloz
mahaloz deleted the proposal/go-small-map-result branch November 22, 2026 22:22
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