Skip to content

fix: support Map<string, number> with value boxing/unboxing#173

Merged
cs01 merged 1 commit intomainfrom
fix/map-string-number
Mar 10, 2026
Merged

fix: support Map<string, number> with value boxing/unboxing#173
cs01 merged 1 commit intomainfrom
fix/map-string-number

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 10, 2026

Summary

  • Map<string, number> was completely broken — stored numeric values as raw i64/double into i8* slots, causing LLVM type errors or wrong values at runtime
  • Added value boxing in generateStringMapSet: converts double/i64/i1 → double → bitcast to i64 → inttoptr to i8*
  • Added value unboxing in method-calls.ts get path: ptrtoint i8* → i64 → bitcast to double when mapMeta.valueType === "number"
  • Fixed global StringMap allocation to extract value type from MapNode (was hardcoded to "string")
  • Added 3 new test fixtures: map-methods (has/delete/clear/size), map-string-keys (Map<string,string>), map-string-number (Map<string,number>)

Test plan

  • 446/447 tests pass (1 pre-existing promise-race SIGKILL)
  • Self-hosting chain passes (quick mode)
  • New map-string-number fixture verifies set/get/has/delete/size all work correctly

@cs01 cs01 merged commit 306180d into main Mar 10, 2026
12 checks passed
@cs01 cs01 deleted the fix/map-string-number branch March 10, 2026 02:57
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