diff options
-rw-r--r-- | src/feature.def | 4 | ||||
-rw-r--r-- | src/opcode.cc | 2 | ||||
-rw-r--r-- | src/validator.cc | 4 | ||||
-rw-r--r-- | test/dump/mutable-global.txt | 2 | ||||
-rw-r--r-- | test/dump/unary-extend.txt | 2 | ||||
-rw-r--r-- | test/help/spectest-interp.txt | 4 | ||||
-rw-r--r-- | test/help/wasm-interp.txt | 4 | ||||
-rw-r--r-- | test/help/wasm-validate.txt | 4 | ||||
-rw-r--r-- | test/help/wasm2wat.txt | 4 | ||||
-rw-r--r-- | test/help/wast2json.txt | 4 | ||||
-rw-r--r-- | test/help/wat-desugar.txt | 4 | ||||
-rw-r--r-- | test/help/wat2wasm.txt | 4 | ||||
-rw-r--r-- | test/interp/logging-all-opcodes.txt | 2 | ||||
-rw-r--r-- | test/interp/tracing-all-opcodes.txt | 2 | ||||
-rw-r--r-- | test/interp/unary-extend.txt | 2 | ||||
-rw-r--r-- | test/parse/export-mutable-global.txt | 2 | ||||
-rw-r--r-- | test/parse/expr/unary-extend.txt | 2 | ||||
-rw-r--r-- | test/parse/module/import-mutable-global.txt | 2 | ||||
-rwxr-xr-x | test/run-interp.py | 15 | ||||
-rwxr-xr-x | test/run-objdump.py | 8 | ||||
-rwxr-xr-x | test/run-roundtrip.py | 15 |
21 files changed, 67 insertions, 25 deletions
diff --git a/src/feature.def b/src/feature.def index ee6d6c8d..a74918e1 100644 --- a/src/feature.def +++ b/src/feature.def @@ -23,6 +23,8 @@ * ========================================================================= */ WABT_FEATURE(exceptions, "exceptions", "Experimental exception handling") +WABT_FEATURE(mutable_globals, "mutable-globals", "Import/export mutable globals") WABT_FEATURE(sat_float_to_int, "saturating-float-to-int", "Saturating float-to-int operators") -WABT_FEATURE(threads, "threads", "Threading support") +WABT_FEATURE(sign_extension, "sign-extension", "Sign-extension operators") WABT_FEATURE(simd, "simd", "SIMD support") +WABT_FEATURE(threads, "threads", "Threading support") diff --git a/src/opcode.cc b/src/opcode.cc index a5f5aa75..280bb87e 100644 --- a/src/opcode.cc +++ b/src/opcode.cc @@ -112,6 +112,8 @@ bool Opcode::IsEnabled(const Features& features) const { case Opcode::I64Extend8S: case Opcode::I64Extend16S: case Opcode::I64Extend32S: + return features.sign_extension_enabled(); + case Opcode::AtomicWake: case Opcode::I32AtomicWait: case Opcode::I64AtomicWait: diff --git a/src/validator.cc b/src/validator.cc index 77fcabda..85715b47 100644 --- a/src/validator.cc +++ b/src/validator.cc @@ -892,7 +892,7 @@ void Validator::CheckImport(const Location* loc, const Import* import) { case ExternalKind::Global: { auto* global_import = cast<GlobalImport>(import); if (global_import->global.mutable_ && - !options_->features.threads_enabled()) { + !options_->features.mutable_globals_enabled()) { PrintError(loc, "mutable globals cannot be imported"); } ++num_imported_globals_; @@ -919,7 +919,7 @@ void Validator::CheckExport(const Location* loc, const Export* export_) { case ExternalKind::Global: { const Global* global; if (Succeeded(CheckGlobalVar(&export_->var, &global, nullptr))) { - if (global->mutable_ && !options_->features.threads_enabled()) { + if (global->mutable_ && !options_->features.mutable_globals_enabled()) { PrintError(&export_->var.loc, "mutable globals cannot be exported"); } } diff --git a/test/dump/mutable-global.txt b/test/dump/mutable-global.txt index 68e40731..24e7d417 100644 --- a/test/dump/mutable-global.txt +++ b/test/dump/mutable-global.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-objdump -;;; FLAGS: -v --dump-verbose --enable-threads +;;; FLAGS: -v --dump-verbose --enable-mutable-globals (module (import "foo" "imported" (global (mut i32))) (global (export "exported") (mut i32) (i32.const 1))) diff --git a/test/dump/unary-extend.txt b/test/dump/unary-extend.txt index ec362ce6..15a0971f 100644 --- a/test/dump/unary-extend.txt +++ b/test/dump/unary-extend.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-objdump -;;; FLAGS: -v --enable-threads +;;; FLAGS: -v --enable-sign-extension (module (func i32.const 0 diff --git a/test/help/spectest-interp.txt b/test/help/spectest-interp.txt index 172e18fb..23afc370 100644 --- a/test/help/spectest-interp.txt +++ b/test/help/spectest-interp.txt @@ -13,9 +13,11 @@ options: -v, --verbose Use multiple times for more info -h, --help Print this help message --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support -V, --value-stack-size=SIZE Size in elements of the value stack -C, --call-stack-size=SIZE Size in elements of the call stack -t, --trace Trace execution diff --git a/test/help/wasm-interp.txt b/test/help/wasm-interp.txt index 5af83907..558648bd 100644 --- a/test/help/wasm-interp.txt +++ b/test/help/wasm-interp.txt @@ -24,9 +24,11 @@ options: -v, --verbose Use multiple times for more info -h, --help Print this help message --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support -V, --value-stack-size=SIZE Size in elements of the value stack -C, --call-stack-size=SIZE Size in elements of the call stack -t, --trace Trace execution diff --git a/test/help/wasm-validate.txt b/test/help/wasm-validate.txt index 2ed28eb5..d7f90116 100644 --- a/test/help/wasm-validate.txt +++ b/test/help/wasm-validate.txt @@ -13,8 +13,10 @@ options: -v, --verbose Use multiple times for more info -h, --help Print this help message --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support --no-debug-names Ignore debug names in the binary file ;;; STDOUT ;;) diff --git a/test/help/wasm2wat.txt b/test/help/wasm2wat.txt index bfee019f..6576dc25 100644 --- a/test/help/wasm2wat.txt +++ b/test/help/wasm2wat.txt @@ -19,9 +19,11 @@ options: -o, --output=FILENAME Output file for the generated wast file, by default use stdout -f, --fold-exprs Write folded expressions where possible --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support --inline-exports Write all exports inline --inline-imports Write all imports inline --no-debug-names Ignore debug names in the binary file diff --git a/test/help/wast2json.txt b/test/help/wast2json.txt index fdb732dc..bf37731f 100644 --- a/test/help/wast2json.txt +++ b/test/help/wast2json.txt @@ -16,9 +16,11 @@ options: -h, --help Print this help message --debug-parser Turn on debugging the parser of wast files --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support -o, --output=FILE output wasm binary file -r, --relocatable Create a relocatable wasm binary (suitable for linking with wasm-link) --no-canonicalize-leb128s Write all LEB128 sizes as 5-bytes instead of their minimal size diff --git a/test/help/wat-desugar.txt b/test/help/wat-desugar.txt index 20e32a37..25967ffb 100644 --- a/test/help/wat-desugar.txt +++ b/test/help/wat-desugar.txt @@ -21,8 +21,10 @@ options: --debug-parser Turn on debugging the parser of wat files -f, --fold-exprs Write folded expressions where possible --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support --generate-names Give auto-generated names to non-named functions, types, etc. ;;; STDOUT ;;) diff --git a/test/help/wat2wasm.txt b/test/help/wat2wasm.txt index e5e751c6..418086db 100644 --- a/test/help/wat2wasm.txt +++ b/test/help/wat2wasm.txt @@ -23,9 +23,11 @@ options: --debug-parser Turn on debugging the parser of wat files -d, --dump-module Print a hexdump of the module to stdout --enable-exceptions Experimental exception handling + --enable-mutable-globals Import/export mutable globals --enable-saturating-float-to-int Saturating float-to-int operators - --enable-threads Threading support + --enable-sign-extension Sign-extension operators --enable-simd SIMD support + --enable-threads Threading support -o, --output=FILE output wasm binary file -r, --relocatable Create a relocatable wasm binary (suitable for linking with wasm-link) --no-canonicalize-leb128s Write all LEB128 sizes as 5-bytes instead of their minimal size diff --git a/test/interp/logging-all-opcodes.txt b/test/interp/logging-all-opcodes.txt index f67f6d5d..5f647ea1 100644 --- a/test/interp/logging-all-opcodes.txt +++ b/test/interp/logging-all-opcodes.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-interp -;;; FLAGS: -v --host-print --enable-threads --enable-saturating-float-to-int +;;; FLAGS: -v --host-print --enable-threads --enable-saturating-float-to-int --enable-sign-extension (module (import "host" "print" (func $print (param i32))) diff --git a/test/interp/tracing-all-opcodes.txt b/test/interp/tracing-all-opcodes.txt index 13a7f342..1471e22d 100644 --- a/test/interp/tracing-all-opcodes.txt +++ b/test/interp/tracing-all-opcodes.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-interp -;;; FLAGS: --trace --host-print --enable-threads --enable-saturating-float-to-int +;;; FLAGS: --trace --host-print --enable-threads --enable-saturating-float-to-int --enable-sign-extension (module (import "host" "print" (func $print (param i32))) diff --git a/test/interp/unary-extend.txt b/test/interp/unary-extend.txt index 29fc8991..3da18a47 100644 --- a/test/interp/unary-extend.txt +++ b/test/interp/unary-extend.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-interp -;;; FLAGS: --enable-threads +;;; FLAGS: --enable-sign-extension (module (func (export "i32.extend8_s 0x7f") (result i32) i32.const 0x7f diff --git a/test/parse/export-mutable-global.txt b/test/parse/export-mutable-global.txt index ae8adb76..0580359d 100644 --- a/test/parse/export-mutable-global.txt +++ b/test/parse/export-mutable-global.txt @@ -1,2 +1,2 @@ -;;; FLAGS: --enable-threads +;;; FLAGS: --enable-mutable-globals (module (global (export "g") (mut f32) (f32.const 1.5))) diff --git a/test/parse/expr/unary-extend.txt b/test/parse/expr/unary-extend.txt index aa9ba508..88791d48 100644 --- a/test/parse/expr/unary-extend.txt +++ b/test/parse/expr/unary-extend.txt @@ -1,4 +1,4 @@ -;;; FLAGS: --enable-threads +;;; FLAGS: --enable-sign-extension (module (func i32.const 0 diff --git a/test/parse/module/import-mutable-global.txt b/test/parse/module/import-mutable-global.txt index 6618ab22..67f68b7e 100644 --- a/test/parse/module/import-mutable-global.txt +++ b/test/parse/module/import-mutable-global.txt @@ -1,2 +1,2 @@ -;;; FLAGS: --enable-threads +;;; FLAGS: --enable-mutable-globals (module (import "mod" "field" (global (mut f32)))) diff --git a/test/run-interp.py b/test/run-interp.py index 91f121c8..6d6bb4d3 100755 --- a/test/run-interp.py +++ b/test/run-interp.py @@ -48,9 +48,12 @@ def main(args): parser.add_argument('--spec', action='store_true') parser.add_argument('-t', '--trace', action='store_true') parser.add_argument('file', help='test file.') + parser.add_argument('--enable-exceptions', action='store_true') + parser.add_argument('--enable-mutable-globals', action='store_true') parser.add_argument('--enable-saturating-float-to-int', action='store_true') - parser.add_argument('--enable-threads', action='store_true') + parser.add_argument('--enable-sign-extension', action='store_true') parser.add_argument('--enable-simd', action='store_true') + parser.add_argument('--enable-threads', action='store_true') options = parser.parse_args(args) wast_tool = None @@ -76,20 +79,26 @@ def main(args): wast_tool.AppendOptionalArgs({ '-v': options.verbose, + '--enable-exceptions': options.enable_exceptions, + '--enable-mutable-globals': options.enable_mutable_globals, '--enable-saturating-float-to-int': options.enable_saturating_float_to_int, - '--enable-threads': options.enable_threads, + '--enable-sign-extension': options.enable_sign_extension, '--enable-simd': options.enable_simd, + '--enable-threads': options.enable_threads, }) interp_tool.AppendOptionalArgs({ '-v': options.verbose, '--run-all-exports': options.run_all_exports, '--trace': options.trace, + '--enable-exceptions': options.enable_exceptions, + '--enable-mutable-globals': options.enable_mutable_globals, '--enable-saturating-float-to-int': options.enable_saturating_float_to_int, - '--enable-threads': options.enable_threads, + '--enable-sign-extension': options.enable_sign_extension, '--enable-simd': options.enable_simd, + '--enable-threads': options.enable_threads, }) wast_tool.verbose = options.print_cmd diff --git a/test/run-objdump.py b/test/run-objdump.py index 758195e3..a891bdb1 100755 --- a/test/run-objdump.py +++ b/test/run-objdump.py @@ -47,9 +47,11 @@ def main(args): parser.add_argument('--dump-verbose', action='store_true') parser.add_argument('--dump-debug', action='store_true') parser.add_argument('--enable-exceptions', action='store_true') + parser.add_argument('--enable-mutable-globals', action='store_true') parser.add_argument('--enable-saturating-float-to-int', action='store_true') - parser.add_argument('--enable-threads', action='store_true') + parser.add_argument('--enable-sign-extension', action='store_true') parser.add_argument('--enable-simd', action='store_true') + parser.add_argument('--enable-threads', action='store_true') parser.add_argument('--gen-wasm', action='store_true', help='parse with gen-wasm') parser.add_argument('--spec', action='store_true') @@ -78,10 +80,12 @@ def main(args): wat_tool.AppendOptionalArgs({ '--debug-names': options.debug_names, '--enable-exceptions': options.enable_exceptions, + '--enable-mutable-globals': options.enable_mutable_globals, '--enable-saturating-float-to-int': options.enable_saturating_float_to_int, - '--enable-threads': options.enable_threads, + '--enable-sign-extension': options.enable_sign_extension, '--enable-simd': options.enable_simd, + '--enable-threads': options.enable_threads, '--no-check': options.no_check, '--no-canonicalize-leb128s': options.no_canonicalize_leb128s, '-v': options.verbose, diff --git a/test/run-roundtrip.py b/test/run-roundtrip.py index 9d7a9df4..b4c7e0c1 100755 --- a/test/run-roundtrip.py +++ b/test/run-roundtrip.py @@ -117,8 +117,11 @@ def main(args): parser.add_argument('--generate-names', action='store_true') parser.add_argument('--fold-exprs', action='store_true') parser.add_argument('--enable-exceptions', action='store_true') + parser.add_argument('--enable-saturating-float-to-int', action='store_true') parser.add_argument('--enable-threads', action='store_true') parser.add_argument('--enable-simd', action='store_true') + parser.add_argument('--enable-sign-extension', action='store_true') + parser.add_argument('--enable-mutable-globals', action='store_true') parser.add_argument('--inline-exports', action='store_true') parser.add_argument('--inline-imports', action='store_true') parser.add_argument('file', help='test file.') @@ -130,8 +133,12 @@ def main(args): wat2wasm.AppendOptionalArgs({ '--debug-names': options.debug_names, '--enable-exceptions': options.enable_exceptions, - '--enable-threads': options.enable_threads, + '--enable-mutable-globals': options.enable_mutable_globals, + '--enable-saturating-float-to-int': + options.enable_saturating_float_to_int, + '--enable-sign-extension': options.enable_sign_extension, '--enable-simd': options.enable_simd, + '--enable-threads': options.enable_threads, '--no-check': options.no_check, }) @@ -141,8 +148,12 @@ def main(args): wasm2wat.AppendOptionalArgs({ '--fold-exprs': options.fold_exprs, '--enable-exceptions': options.enable_exceptions, - '--enable-threads': options.enable_threads, + '--enable-mutable-globals': options.enable_mutable_globals, + '--enable-saturating-float-to-int': + options.enable_saturating_float_to_int, + '--enable-sign-extension': options.enable_sign_extension, '--enable-simd': options.enable_simd, + '--enable-threads': options.enable_threads, '--inline-exports': options.inline_exports, '--inline-imports': options.inline_imports, '--no-debug-names': not options.debug_names, |