Skip to content

Extend FastKeyedMap with string keys - #507

Draft
Frotty wants to merge 2 commits into
masterfrom
codex/fast-keyed-map-string-poc
Draft

Frotty wants to merge 2 commits into
masterfrom
codex/fast-keyed-map-string-poc

Conversation

@Frotty

@Frotty Frotty commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

FastKeyedMap currently accepts only handle keys. This change extends the existing API to string keys, so new FastKeyedMap<string, int>() works with the matching compiler change.

Companion compiler PR: wurstscript/WurstScript#1408.

The generic put/get/has/remove operations lower to native Lua table operations. Jass uses StringHash buckets with full string equality checks, preserves stored zero versus absence, and frees collision entries on remove and destroy. Legacy handle functions remain compatible. Tests cover colliding case variants, empty keys, overwrite, independent maps, removal and reuse.

Validation: grill install succeeded; grill typecheck succeeded and all 525 stdlib tests passed using an isolated build of the matching compiler on Java 27. The installed release compiler does not support the new intrinsics yet.

Supported types: handle and string keys, with int/class-reference values on Jass. Integer/class keys, a stronger source-level key bound, and broader Jass value support are follow-ups. Jass collision entries use the normal class allocator and its capacity limit; Lua creates no collision entries. This PR requires the companion compiler change before merge.

@Frotty Frotty changed the title PoC: extend FastKeyedMap with native string keys Extend FastKeyedMap with string keys Oct 9, 2026
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