[TS] Split C -> JS function calls based on u32/u64 parameters/return
authorMatt Corallo <git@bluematt.me>
Thu, 30 Jun 2022 04:19:13 +0000 (04:19 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 30 Jun 2022 19:03:29 +0000 (19:03 +0000)
commit79d81af1dcf68ebcf96e58dfe89ab04291b9a009
tree8c057feb01c934bec227888375f47b4a8dd9c3fb
parent47341beaeecf907f422f126500baf586d54a0d41
[TS] Split C -> JS function calls based on u32/u64 parameters/return

We were calling all C -> JS functions with u32 parameters and
return types. This is fine for all of our pointers, as well as any
smaller types - u32 always gets mapped to a JavaScript `number`, so
its all consistent.

However, for u64 parameters/returns, we map the values to
JavaScript `bigint`s, which are not compatible with `numbers`, and
the correct type is checked at the FFI when returning or when users
ultimately try to use a passed `bigint` as if it were a `number`.

Thus, we have to split the `js_invoke_function` family by the
parameters and return values, using `u` for u32s and `b` for u64s
to do so.
ts/js-wasm.h
typescript_strings.py