Skip to content

parseTools helpers like toIndexType and to64 #24760

Answered by sbc100
cwoffenden asked this question in Q&A
Discussion options

You must be logged in to vote

In terms of pointers, the idea is that all pointers on the JS side are numbers. When pointers flow into JS there should always be bigint -> number conversion and then pointers flow out of JS there should be a number -> bigint conversion.

There are some places that we currently cannot do that and the user ends up being exposed to bigints when running on wasm64 (IIRC EM_JS is one example).

toIndexType is for interacting with the WebAssembly JS API, its will convert a value to bigint if that index type being uses is 64-bit (i.e. in wasm64 mode). Otherwise the index type is number and no conversion is done.

to64 is very similar, but there is a subtle difference: it will convert also when MEMO…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cwoffenden
Comment options

Answer selected by cwoffenden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants