From c5ad2e5ecc517030aa242c18fd738b9d79f11429 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 8 Apr 2019 15:49:26 -0700 Subject: Move segment merging to fit web limits into its own pass (#1980) It was previously part of writing a binary, but changing the number of segments at such a late stage would not work in the presence of bulk memory's datacount section. Also updates the memory packing pass to respect the web's limits on the number of data segments. --- src/tools/wasm-ctor-eval.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/tools/wasm-ctor-eval.cpp') diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 8b8eaa4ad..be1de7684 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -25,9 +25,9 @@ #include #include "pass.h" -#include "support/command-line.h" #include "support/file.h" #include "support/colors.h" +#include "tool-options.h" #include "wasm-io.h" #include "wasm-interpreter.h" #include "wasm-builder.h" @@ -383,7 +383,7 @@ int main(int argc, const char* argv[]) { bool debugInfo = false; std::string ctorsString; - Options options("wasm-ctor-eval", "Execute C++ global constructors ahead of time"); + ToolOptions options("wasm-ctor-eval", "Execute C++ global constructors ahead of time"); options .add("--output", "-o", "Output file (stdout if not specified)", Options::Arguments::One, @@ -425,6 +425,8 @@ int main(int argc, const char* argv[]) { } } + options.calculateFeatures(wasm); + if (!WasmValidator().validate(wasm)) { WasmPrinter::printModule(&wasm); Fatal() << "error in validating input"; @@ -442,6 +444,7 @@ int main(int argc, const char* argv[]) { // Do some useful optimizations after the evalling { PassRunner passRunner(&wasm); + passRunner.setFeatures(options.passOptions.features); passRunner.add("memory-packing"); // we flattened it, so re-optimize passRunner.add("remove-unused-names"); passRunner.add("dce"); -- cgit v1.2.3