Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #100
Not sure how much you are targeting JavaScriptCore, but ran into this issue myself as well.
/runtime/limits.ts made 1n << BigInt(MAX_BIGINT_BITS) when it loaded, to compare against. Turns our 2^(2^20) is one bit more than JavaScriptCore allows a BigInt. This was causing issues when running ps in Safari.
RangeError: Out of memory: BigInt generated from this operation is too big.The bounds are now the largest values that fit, ±(2^(2^20) − 1), compared with <=/>=. The range is the same, and both are still made once. They're made with BigInt.asUintN(MAX_BIGINT_BITS, -1n): building the value with + or * also throws in JavaScriptCore, which sizes the result for a carry before computing it.
Checked in Playwright's WebKit (WebKit 26.0) and in Chrome by bundling src/ for the browser:
on dev, WebKit: the import throws the RangeError above
with this change, WebKit: the import succeeds and 2n ** 64n runs; 2n ** 1048576n and 1n << 1048576n give RangeError:
There's no new test. Bun's JavaScriptCore allows the extra bit (1n << BigInt(2 ** 20) works in bun -e), so a test under bun test would pass before and after this change.
If you do want webkit fixes I did notice one more that I didn't slip in here: arithmetic whose result could cross 2^20 bits, like max + 1n or max * 2n with max at the limit, throws JavaScriptCore's own RangeError from inside the operation, before checkBigIntSize runs. That error ends the run as an ExecutionFailure instead of reaching the program's catch. I can follow up on it separately if that's useful.