diff options
-rw-r--r-- | src/tools/tool-options.h | 1 | ||||
-rw-r--r-- | src/wasm-binary.h | 1 | ||||
-rw-r--r-- | src/wasm-features.h | 9 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 5 | ||||
-rw-r--r-- | src/wasm/wasm.cpp | 1 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js.txt | 2 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 2 | ||||
-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-merge.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 | ||||
-rw-r--r-- | test/passes/strip-target-features_roundtrip_print-features_all-features.txt | 1 | ||||
-rw-r--r-- | test/unit/test_features.py | 1 |
19 files changed, 60 insertions, 3 deletions
diff --git a/src/tools/tool-options.h b/src/tools/tool-options.h index f7dd791b4..6d68ff3c1 100644 --- a/src/tools/tool-options.h +++ b/src/tools/tool-options.h @@ -93,6 +93,7 @@ struct ToolOptions : public Options { .addFeature(FeatureSet::ExtendedConst, "extended const expressions") .addFeature(FeatureSet::Strings, "strings") .addFeature(FeatureSet::MultiMemory, "multimemory") + .addFeature(FeatureSet::TypedContinuations, "typed continuations") .add("--enable-typed-function-references", "", "Deprecated compatibility flag", diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 72b61223f..8a4d6969f 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -502,6 +502,7 @@ extern const char* RelaxedSIMDFeature; extern const char* ExtendedConstFeature; extern const char* StringsFeature; extern const char* MultiMemoryFeature; +extern const char* TypedContinuationsFeature; enum Subsection { NameModule = 0, diff --git a/src/wasm-features.h b/src/wasm-features.h index f8d006e78..2ace67c27 100644 --- a/src/wasm-features.h +++ b/src/wasm-features.h @@ -44,11 +44,12 @@ struct FeatureSet { ExtendedConst = 1 << 13, Strings = 1 << 14, MultiMemory = 1 << 15, + TypedContinuations = 1 << 16, MVP = None, // Keep in sync with llvm default features: // https://github.com/llvm/llvm-project/blob/c7576cb89d6c95f03968076e902d3adfd1996577/clang/lib/Basic/Targets/WebAssembly.cpp#L150-L153 Default = SignExt | MutableGlobals, - All = (1 << 16) - 1, + All = (1 << 17) - 1, }; static std::string toString(Feature f) { @@ -85,6 +86,8 @@ struct FeatureSet { return "strings"; case MultiMemory: return "multimemory"; + case TypedContinuations: + return "typed-continuations"; default: WASM_UNREACHABLE("unexpected feature"); } @@ -129,6 +132,9 @@ struct FeatureSet { bool hasExtendedConst() const { return (features & ExtendedConst) != 0; } bool hasStrings() const { return (features & Strings) != 0; } bool hasMultiMemory() const { return (features & MultiMemory) != 0; } + bool hasTypedContinuations() const { + return (features & TypedContinuations) != 0; + } bool hasAll() const { return (features & All) != 0; } void set(FeatureSet f, bool v = true) { @@ -150,6 +156,7 @@ struct FeatureSet { void setExtendedConst(bool v = true) { set(ExtendedConst, v); } void setStrings(bool v = true) { set(Strings, v); } void setMultiMemory(bool v = true) { set(MultiMemory, v); } + void setTypedContinuations(bool v = true) { set(TypedContinuations, v); } void setMVP() { features = MVP; } void setAll() { features = All; } diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index e9adc5e0e..b3108100f 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1256,6 +1256,8 @@ void WasmBinaryWriter::writeFeaturesSection() { return BinaryConsts::CustomSections::StringsFeature; case FeatureSet::MultiMemory: return BinaryConsts::CustomSections::MultiMemoryFeature; + case FeatureSet::TypedContinuations: + return BinaryConsts::CustomSections::TypedContinuationsFeature; default: WASM_UNREACHABLE("unexpected feature flag"); } @@ -3708,6 +3710,9 @@ void WasmBinaryReader::readFeatures(size_t payloadLen) { feature = FeatureSet::Strings; } else if (name == BinaryConsts::CustomSections::MultiMemoryFeature) { feature = FeatureSet::MultiMemory; + } else if (name == + BinaryConsts::CustomSections::TypedContinuationsFeature) { + feature = FeatureSet::TypedContinuations; } else { // Silently ignore unknown features (this may be and old binaryen running // on a new wasm). diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 21dc6e25e..e5f3deb33 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -51,6 +51,7 @@ const char* RelaxedSIMDFeature = "relaxed-simd"; const char* ExtendedConstFeature = "extended-const"; const char* StringsFeature = "strings"; const char* MultiMemoryFeature = "multimemory"; +const char* TypedContinuationsFeature = "typed-continuations"; } // namespace CustomSections } // namespace BinaryConsts diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 6ae736ff0..313d51efa 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -33,7 +33,7 @@ Features.RelaxedSIMD: 4096 Features.ExtendedConst: 8192 Features.Strings: 16384 Features.MultiMemory: 32768 -Features.All: 65535 +Features.All: 131071 InvalidId: 0 BlockId: 1 IfId: 2 diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index f7df65f71..2a3ecea9d 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -53,7 +53,7 @@ BinaryenFeatureMemory64: 2048 BinaryenFeatureRelaxedSIMD: 4096 BinaryenFeatureExtendedConst: 8192 BinaryenFeatureStrings: 16384 -BinaryenFeatureAll: 65535 +BinaryenFeatureAll: 131071 (f32.neg (f32.const -33.61199951171875) ) diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test index 8cad64a3b..bf12fc1cf 100644 --- a/test/lit/help/wasm-as.test +++ b/test/lit/help/wasm-as.test @@ -104,6 +104,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index b93f90b37..bbf8e1daa 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -111,6 +111,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test index 010a430e8..f1f8283c8 100644 --- a/test/lit/help/wasm-dis.test +++ b/test/lit/help/wasm-dis.test @@ -97,6 +97,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index 4005dd911..9b3913129 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -144,6 +144,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test index 65acdff40..50719f988 100644 --- a/test/lit/help/wasm-merge.test +++ b/test/lit/help/wasm-merge.test @@ -115,6 +115,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index 2fa50775e..4334dbd01 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -145,6 +145,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index 77974d4b2..213b09e88 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -677,6 +677,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test index a780d8bf9..e28894e4a 100644 --- a/test/lit/help/wasm-reduce.test +++ b/test/lit/help/wasm-reduce.test @@ -133,6 +133,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index eac557a9e..e7b287fcc 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -213,6 +213,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index b896730a3..04c7d5577 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -636,6 +636,10 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-multimemory Disable multimemory ;; CHECK-NEXT: +;; CHECK-NEXT: --enable-typed-continuations Enable typed continuations +;; CHECK-NEXT: +;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations +;; CHECK-NEXT: ;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag ;; CHECK-NEXT: ;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt index 35906894b..f52a92856 100644 --- a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt +++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt @@ -14,6 +14,7 @@ --enable-extended-const --enable-strings --enable-multimemory +--enable-typed-continuations (module (type $0 (func (result v128 externref))) (func $foo (type $0) (result v128 externref) diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 75e87b7d5..cbdae1c56 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -396,4 +396,5 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase): '--enable-extended-const', '--enable-strings', '--enable-multimemory', + '--enable-typed-continuations', ], p2.stdout.splitlines()) |