diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-09-21 15:30:12 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-21 15:30:12 -0700 |
commit | c79bbb19b59161e0768674816b477f74355912b1 (patch) | |
tree | 05ee48cda6eb33fb49c10d452189d920ec6004df /src | |
parent | da134d909f0b9dbd49545ceed77e37721b32f0d1 (diff) | |
download | binaryen-c79bbb19b59161e0768674816b477f74355912b1.tar.gz binaryen-c79bbb19b59161e0768674816b477f74355912b1.tar.bz2 binaryen-c79bbb19b59161e0768674816b477f74355912b1.zip |
error on putting spectest.print in a table
Diffstat (limited to 'src')
-rw-r--r-- | src/shell-interface.h | 4 | ||||
-rw-r--r-- | src/tools/wasm-shell.cpp | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/shell-interface.h b/src/shell-interface.h index 8cb7c2672..b9a90131b 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -122,6 +122,10 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { case f64: globals[import->name] = Literal(double(666.6)); break; default: WASM_UNREACHABLE(); } + } else if (import->kind == Import::Memory && import->module == SPECTEST && import->base == MEMORY) { + // imported memory has initial 1 and max 2 + wasm.memory.initial = 1; + wasm.memory.max = 2; } } } diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp index 83d39c9d4..670f5783d 100644 --- a/src/tools/wasm-shell.cpp +++ b/src/tools/wasm-shell.cpp @@ -171,6 +171,17 @@ static void run_asserts(Name moduleName, size_t* i, bool* checked, Module* wasm, break; } } + for (auto& segment : wasm.table.segments) { + for (auto name : segment.data) { + // spec tests consider it illegal to use spectest.print in a table + if (auto* import = wasm.checkImport(name)) { + if (import->module == SPECTEST && import->base == PRINT) { + std::cerr << "cannot put spectest.print in table\n"; + invalid = true; + } + } + } + } } if (!invalid) { Colors::red(std::cerr); |