diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2022-01-19 10:14:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 10:14:45 -0800 |
commit | b9fdc3b1155c48749f48f5b530d8ab295ea3185b (patch) | |
tree | e3b2dbdcb346e83cdccdfe99b3e77557ad3585eb | |
parent | 59494a57abf7873e09fd4fba8e0413f649b64525 (diff) | |
download | binaryen-b9fdc3b1155c48749f48f5b530d8ab295ea3185b.tar.gz binaryen-b9fdc3b1155c48749f48f5b530d8ab295ea3185b.tar.bz2 binaryen-b9fdc3b1155c48749f48f5b530d8ab295ea3185b.zip |
Add a `--hybrid` type system option (#4460)
Eventually this will enable the isorecursive hybrid type system described in
https://github.com/WebAssembly/gc/pull/243, but for now it just throws a fatal
error if used.
-rw-r--r-- | src/tools/tool-options.h | 9 | ||||
-rw-r--r-- | src/wasm-type.h | 1 | ||||
-rw-r--r-- | src/wasm/wasm-type.cpp | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-as.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-ctor-eval.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-dis.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-emscripten-finalize.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-metadce.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-opt.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-reduce.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-split.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm2js.test | 4 |
12 files changed, 49 insertions, 0 deletions
diff --git a/src/tools/tool-options.h b/src/tools/tool-options.h index f45569648..0ed0f27fb 100644 --- a/src/tools/tool-options.h +++ b/src/tools/tool-options.h @@ -135,6 +135,15 @@ struct ToolOptions : public Options { Options::Arguments::Zero, [](Options* o, const std::string& argument) { setTypeSystem(TypeSystem::Equirecursive); + }) + .add("--hybrid", + "", + "Force all GC type definitions to be parsed using the isorecursive " + "hybrid type system.", + ToolOptionsCategory, + Options::Arguments::Zero, + [](Options* o, const std::string& argument) { + setTypeSystem(TypeSystem::Isorecursive); }); } diff --git a/src/wasm-type.h b/src/wasm-type.h index a54104cc0..c80e7cd0b 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -36,6 +36,7 @@ namespace wasm { enum class TypeSystem { Equirecursive, Nominal, + Isorecursive, }; // This should only ever be called before any Types or HeapTypes have been diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index a63c66770..738cd6e29 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -3197,6 +3197,9 @@ std::vector<HeapType> TypeBuilder::build() { case TypeSystem::Nominal: canonicalizeNominal(state); break; + case TypeSystem::Isorecursive: + Fatal() << "Isorecursive types not yet implemented"; + break; } #if TIME_CANONICALIZATION diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test index 562213b6c..cc3b350a7 100644 --- a/test/lit/help/wasm-as.test +++ b/test/lit/help/wasm-as.test @@ -114,6 +114,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index b3b577250..626a49557 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -118,6 +118,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test index 19a002e89..b4573d1a6 100644 --- a/test/lit/help/wasm-dis.test +++ b/test/lit/help/wasm-dis.test @@ -107,6 +107,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index 604e11081..1ed81729c 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -162,6 +162,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index cae3dd222..80dfc3183 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -155,6 +155,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index 666ffe6ac..ef6a7637b 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -609,6 +609,10 @@ ;; CHECK-NEXT: equirecursive). This is the ;; CHECK-NEXT: default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to +;; CHECK-NEXT: be parsed using the isorecursive +;; CHECK-NEXT: hybrid type system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test index 86df1ce23..5c6cb05cc 100644 --- a/test/lit/help/wasm-reduce.test +++ b/test/lit/help/wasm-reduce.test @@ -143,6 +143,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index a20d430fa..cd275c79f 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -196,6 +196,10 @@ ;; CHECK-NEXT: parsed as structural (i.e. ;; CHECK-NEXT: equirecursive). This is the default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to be +;; CHECK-NEXT: parsed using the isorecursive hybrid type +;; CHECK-NEXT: system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index 1dbb58fda..a10eee344 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -571,6 +571,10 @@ ;; CHECK-NEXT: equirecursive). This is the ;; CHECK-NEXT: default. ;; CHECK-NEXT: +;; CHECK-NEXT: --hybrid Force all GC type definitions to +;; CHECK-NEXT: be parsed using the isorecursive +;; CHECK-NEXT: hybrid type system. +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- |