Skip to content

BigInt support #2726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2020
Merged

BigInt support #2726

merged 3 commits into from
Apr 7, 2020

Conversation

kripken
Copy link
Member

@kripken kripken commented Apr 7, 2020

If wasm-emscripten-finalize is given the BigInt flag, then we will
be using BigInts on the JS side, and need no legalization at all
since i64s will just be BigInts.

(unreachable)
)
)

Copy link
Member

Choose a reason for hiding this comment

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

remove trailing newline

(export "__data_end" (global $global$1))
(global $global$0 (mut i32) (i32.const 66208))
(global $global$1 i32 (i32.const 658))
(func $foo (param i64) (result i64)
Copy link
Member

Choose a reason for hiding this comment

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

I was expecting to see imports and exports of i64 functions here... is putting it the table enough to test the legalization?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the legalization path would create a legalized dynCall with i32 pairs etc.

@kripken kripken merged commit eaa7240 into master Apr 7, 2020
@kripken kripken deleted the bigint branch April 7, 2020 18:59
kripken added a commit to emscripten-core/emscripten that referenced this pull request Apr 10, 2020
This adds a flag WASM_BIGINT which enables this feature, with
which we let the JS VM use a JS BigInt for a wasm i64. In that case
we don't need to legalize i64s into pairs of i32s.

This is fairly straightforward, but we do need to modify the JS code
of each library method that receives or returns an i64.

Tests verify that we can send and receive i64s from wasm to JS,
and also that a dynCall works. This depends on
WebAssembly/binaryen#2726 for that.
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