summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-04-07 11:59:29 -0700
committerGitHub <noreply@github.com>2020-04-07 11:59:29 -0700
commiteaa7240105811ffa565dc97768f1399e7855744b (patch)
tree2a7a8897d5d139013a891f6fe687d167b8706584 /src
parentac8b0b71219a1c96d3dab4c9eeddbb4c8401cd1d (diff)
downloadbinaryen-eaa7240105811ffa565dc97768f1399e7855744b.tar.gz
binaryen-eaa7240105811ffa565dc97768f1399e7855744b.tar.bz2
binaryen-eaa7240105811ffa565dc97768f1399e7855744b.zip
JS/Wasm BigInt support for wasm-emscripten-finalize (#2726)
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.
Diffstat (limited to 'src')
-rw-r--r--src/tools/wasm-emscripten-finalize.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools/wasm-emscripten-finalize.cpp b/src/tools/wasm-emscripten-finalize.cpp
index 576b64a1a..ce1729bb9 100644
--- a/src/tools/wasm-emscripten-finalize.cpp
+++ b/src/tools/wasm-emscripten-finalize.cpp
@@ -52,6 +52,7 @@ int main(int argc, const char* argv[]) {
bool DWARF = false;
bool sideModule = false;
bool legalizeJavaScriptFFI = true;
+ bool bigInt = false;
bool checkStackOverflow = false;
uint64_t globalBase = INVALID_BASE;
bool standaloneWasm = false;
@@ -118,6 +119,13 @@ int main(int argc, const char* argv[]) {
[&legalizeJavaScriptFFI](Options* o, const std::string&) {
legalizeJavaScriptFFI = false;
})
+ .add("--bigint",
+ "-bi",
+ "Assume JS will use wasm/JS BigInt integration, so wasm i64s will "
+ "turn into JS BigInts, and there is no need for any legalization at "
+ "all (not even minimal legalization of dynCalls)",
+ Options::Arguments::Zero,
+ [&bigInt](Options* o, const std::string&) { bigInt = true; })
.add("--output-source-map",
"-osm",
"Emit source map to the specified file",
@@ -272,8 +280,8 @@ int main(int argc, const char* argv[]) {
generator.generateDynCallThunks();
}
- // Legalize the wasm.
- {
+ // Legalize the wasm, if BigInts don't make that moot.
+ if (!bigInt) {
BYN_TRACE("legalizing types\n");
PassRunner passRunner(&wasm);
passRunner.setOptions(options.passOptions);