summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-11-28 16:47:04 -0800
committerGitHub <noreply@github.com>2022-11-29 00:47:04 +0000
commiteeb838155dbff2fb6731f1ae5550cbb9494532fe (patch)
tree531f3900841cfd978d83723f09b92b6e9eefb9dd
parent2c0fb8c513b3534576383d250c593a9bd28347e3 (diff)
downloadbinaryen-eeb838155dbff2fb6731f1ae5550cbb9494532fe.tar.gz
binaryen-eeb838155dbff2fb6731f1ae5550cbb9494532fe.tar.bz2
binaryen-eeb838155dbff2fb6731f1ae5550cbb9494532fe.zip
Add a placeholder closed-world flag (#5298)
The flag does nothing so far.
-rw-r--r--src/tools/optimization-options.h12
-rw-r--r--test/lit/help/wasm-opt.test9
-rw-r--r--test/lit/help/wasm2js.test9
3 files changed, 30 insertions, 0 deletions
diff --git a/src/tools/optimization-options.h b/src/tools/optimization-options.h
index 8bca7639f..a1a21b596 100644
--- a/src/tools/optimization-options.h
+++ b/src/tools/optimization-options.h
@@ -241,6 +241,18 @@ struct OptimizationOptions : public ToolOptions {
OptimizationOptionsCategory,
Options::Arguments::Zero,
[this](Options*, const std::string&) { passOptions.fastMath = true; })
+ .add(
+ "--closed-world",
+ "-cw",
+ "Assume code outside of the module does not inspect or interact with "
+ "GC and function references, even if they are passed out. The outside "
+ "may hold on to them and pass them back in, but not inspect their "
+ "contents or call them.",
+ OptimizationOptionsCategory,
+ Options::Arguments::Zero,
+ [](Options*, const std::string&) {
+ // TODO: Implement this.
+ })
.add("--zero-filled-memory",
"-uim",
"Assume that an imported memory will be zero-initialized",
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index bdc4b9cd8..d7c70bc9e 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -551,6 +551,15 @@
;; CHECK-NEXT: corner cases of NaNs and
;; CHECK-NEXT: rounding
;; CHECK-NEXT:
+;; CHECK-NEXT: --closed-world,-cw Assume code outside of the
+;; CHECK-NEXT: module does not inspect or
+;; CHECK-NEXT: interact with GC and function
+;; CHECK-NEXT: references, even if they are
+;; CHECK-NEXT: passed out. The outside may hold
+;; CHECK-NEXT: on to them and pass them back
+;; CHECK-NEXT: in, but not inspect their
+;; CHECK-NEXT: contents or call them.
+;; CHECK-NEXT:
;; CHECK-NEXT: --zero-filled-memory,-uim Assume that an imported memory
;; CHECK-NEXT: will be zero-initialized
;; CHECK-NEXT:
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index 16c6c45fc..270f03fbf 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -510,6 +510,15 @@
;; CHECK-NEXT: corner cases of NaNs and
;; CHECK-NEXT: rounding
;; CHECK-NEXT:
+;; CHECK-NEXT: --closed-world,-cw Assume code outside of the
+;; CHECK-NEXT: module does not inspect or
+;; CHECK-NEXT: interact with GC and function
+;; CHECK-NEXT: references, even if they are
+;; CHECK-NEXT: passed out. The outside may hold
+;; CHECK-NEXT: on to them and pass them back
+;; CHECK-NEXT: in, but not inspect their
+;; CHECK-NEXT: contents or call them.
+;; CHECK-NEXT:
;; CHECK-NEXT: --zero-filled-memory,-uim Assume that an imported memory
;; CHECK-NEXT: will be zero-initialized
;; CHECK-NEXT: