Skip to content

migrate to bigint backed (u)int64#3404

Open
hackwaly wants to merge 1 commit intomainfrom
yuxiang/bigint-backed-int64
Open

migrate to bigint backed (u)int64#3404
hackwaly wants to merge 1 commit intomainfrom
yuxiang/bigint-backed-int64

Conversation

@hackwaly
Copy link
Copy Markdown
Contributor

@hackwaly hackwaly commented Apr 1, 2026

Note: This PR needs upcoming compiler release to merge.

Summary

This PR migrates the JS-side Int64/UInt64 implementation to a BigInt-backed representation and removes the old manual { hi, lo } emulation path.

Concretely, this change:

  • switches JS 64-bit integer handling to use native BigInt semantics
  • collapses the split int64_js.mbt / int64_nonjs.mbt implementation into a single intrinsic-based builtin/int64.mbt
  • updates JS interop helpers such as BigInt::from_int64, BigInt::from_uint64, Int64::to_string, UInt64::to_string, and
    env.now to match the new representation
  • replaces the custom JS Double -> (U)Int64 conversion logic with saturating runtime intrinsics
  • reuses the same double_to_int64 implementation for JS, Wasm, and Wasm GC
  • removes obsolete target-specific files and simplifies builtin/moon.pkg target selection

Motivation

The main goal is to stop maintaining a separate hi/lo-based 64-bit emulation path on JS and align the implementation more closely
with the intrinsic model used on other backends.

This reduces target-specific duplication, simplifies the runtime boundary, and makes the behavior of 64-bit integer operations
easier to maintain going forward.

Compatibility

No intended public API changes.

There are also no .mbti changes in this branch, so this should be a refactoring from the package interface perspective.

Testing

  • Not run locally yet.

Open with Devin

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 1, 2026

Pull Request Test Coverage Report for Build 3720

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.006%

Totals Coverage Status
Change from base Build 3718: 0.0%
Covered Lines: 14610
Relevant Lines: 15378

💛 - Coveralls

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@hackwaly hackwaly force-pushed the yuxiang/bigint-backed-int64 branch 2 times, most recently from 4ed6082 to d073e26 Compare April 2, 2026 08:38
@hackwaly hackwaly force-pushed the yuxiang/bigint-backed-int64 branch from d073e26 to 7dd03d3 Compare April 3, 2026 02:59
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.

2 participants