diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-10-29 21:39:05 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-10-29 21:39:05 -0700 |
commit | 86626450d7bc165be94efb004e9e3699074777a4 (patch) | |
tree | 3465f4907d9816eb9dc6292d82cf3cbe94223950 /src | |
parent | 0b866305ecee485ec5ef2a314fe79ac2df52b21a (diff) | |
download | binaryen-86626450d7bc165be94efb004e9e3699074777a4.tar.gz binaryen-86626450d7bc165be94efb004e9e3699074777a4.tar.bz2 binaryen-86626450d7bc165be94efb004e9e3699074777a4.zip |
nop imports; all tests pass
Diffstat (limited to 'src')
-rw-r--r-- | src/asm2wasm.cpp | 8 | ||||
-rw-r--r-- | src/wasm.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp index 50f504c6a..6e597ab94 100644 --- a/src/asm2wasm.cpp +++ b/src/asm2wasm.cpp @@ -911,8 +911,16 @@ Function* Asm2WasmModule::processFunction(Ref ast) { } Call* ret; if (imports.find(name) != imports.end()) { + // no imports yet in reference interpreter, fake it + AsmType asmType = detectType(astStackHelper.getParent(), &asmData); + if (asmType == ASM_NONE) return allocator.alloc<Nop>(); + if (asmType == ASM_INT) return allocator.alloc<Const>()->set(Literal((int32_t)0)); + if (asmType == ASM_DOUBLE) return allocator.alloc<Const>()->set(Literal((double)0.0)); + abort(); +#if 0 ret = allocator.alloc<CallImport>(); noteImportedFunctionCall(ast, astStackHelper.getParent(), &asmData); +#endif } else { ret = allocator.alloc<Call>(); } diff --git a/src/wasm.h b/src/wasm.h index 45c557d7b..5e8b7a212 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -807,11 +807,13 @@ public: curr.second->print(o, indent, true); o << '\n'; } +#if 0 for (auto& curr : imports) { doIndent(o, indent); curr.second.print(o, indent); o << '\n'; } +#endif for (auto& curr : exports) { doIndent(o, indent); curr.print(o, indent); |