summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh2
-rwxr-xr-xcheck.py3
-rw-r--r--src/wasm-shell.cpp6
3 files changed, 6 insertions, 5 deletions
diff --git a/build.sh b/build.sh
index 2ca970548..c049c3c6b 100755
--- a/build.sh
+++ b/build.sh
@@ -4,5 +4,5 @@ echo "building interpreter/js"
em++ -std=c++11 src/wasm-js.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -s DEMANGLE_SUPPORT=1 -O3 -profiling -s TOTAL_MEMORY=67108864 -s SAFE_HEAP=1 -s ASSERTIONS=1 #-DWASM_JS_DEBUG #-DWASM_INTERPRETER_DEBUG
cat src/js/post.js >> bin/wasm.js
echo "building wasm shell"
-#g++ -O2 -std=c++11 src/wasm-shell.cpp -g -o bin/wasm-shell
+g++ -O2 -std=c++11 src/wasm-shell.cpp -g -o bin/wasm-shell
diff --git a/check.py b/check.py
index 2e5252715..dd507d038 100755
--- a/check.py
+++ b/check.py
@@ -83,7 +83,7 @@ if len(requested) == 0:
#spec_tests = [] # XXX [os.path.join('spec', t) for t in sorted(os.listdir(os.path.join('test', 'spec')))]
# 'address' : filed issue, test looks invalid
# 'exports' : has a "return" https://github.com/WebAssembly/spec/issues/164
- spec_tests = [os.path.join('spec', t + '.wast') for t in ['conversions', 'endianness', 'f32_cmp', 'f32', 'f64_cmp', 'f64', 'float_exprs', 'forward', 'func_ptrs', 'functions', 'has_feature', 'i32']]
+ spec_tests = [os.path.join('spec', t + '.wast') for t in ['conversions', 'endianness', 'f32_cmp', 'f32', 'f64_cmp', 'f64', 'float_exprs', 'forward', 'func_ptrs', 'functions', 'has_feature', 'i32', 'i64', 'imports']]
else:
spec_tests = requested[:]
@@ -103,6 +103,7 @@ for t in spec_tests:
x = x.strip()
if not x: return x
v, t = x.split(' : ')
+ if v.endswith('.'): v = v[:-1] # remove trailing '.'
return '(' + t + '.const ' + v + ')'
expected = '\n'.join(map(fix, expected.split('\n')))
else:
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp
index c81ce55ad..d16042d24 100644
--- a/src/wasm-shell.cpp
+++ b/src/wasm-shell.cpp
@@ -14,6 +14,7 @@ using namespace wasm;
IString ASSERT_RETURN("assert_return"),
ASSERT_TRAP("assert_trap"),
ASSERT_INVALID("assert_invalid"),
+ STDIO("stdio"),
PRINT("print"),
INVOKE("invoke");
@@ -37,11 +38,10 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
}
Literal callImport(Import *import, ModuleInstance::LiteralList& arguments) override {
- if (import->name == PRINT) {
+ if (import->module == STDIO && import->base == PRINT) {
for (auto argument : arguments) {
- std::cout << argument << ' ';
+ std::cout << argument << '\n';
}
- std::cout << '\n';
return Literal();
}
std::cout << "callImport " << import->name.str << "\n";