Skip to content

fix(compiler): load UInt64 constants as raw bits#89

Merged
skydread1 merged 2 commits into
developfrom
fix/88-uint64-constant-emission
Jul 23, 2026
Merged

fix(compiler): load UInt64 constants as raw bits#89
skydread1 merged 2 commits into
developfrom
fix/88-uint64-constant-emission

Conversation

@skydread1

Copy link
Copy Markdown
Member

Closes #88

  • load-constant UInt64 passes (unchecked-long k) to il/ldc-i8 so the operand reaches mage as a long matching the ldc.i8 opcode. A raw UInt64 hit mage's reflective Emit fallthrough, which has no ulong overload and encoded the operand through a wrong-width one, corrupting the instruction stream.
  • Adds UInt64/MaxValue coverage to the unsigned-constants literal test.
  • Refreshes the magic.core.clj.dll bootstrap binary.

load-constant passed the raw UInt64 to il/ldc-i8, and mage's emit
fallthrough resolves the Emit overload reflectively from the operand's
runtime type. No ulong overload exists, so a wrong-width overload
encoded the operand and corrupted the method's instruction stream.
Cast to unchecked-long so the operand hits the Int64 overload, same
shape as the UInt32 fix.
@skydread1 skydread1 self-assigned this Jul 23, 2026
@skydread1
skydread1 merged commit c65bfa4 into develop Jul 23, 2026
1 check passed
@skydread1
skydread1 deleted the fix/88-uint64-constant-emission branch July 24, 2026 01:33
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.

UInt64 constants emit corrupted IL through mage untyped Emit dispatch

1 participant