diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/asm2wasm.h | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -112,7 +112,7 @@ Same as Emscripten: MIT license. ## TODO * Waiting for switch to stablize on the spec repo; switches are Nop'ed. - * Waiting for an interpreter with module importing support; imports are Nop'ed. + * Reference interpreter lacks module importing support; imports are Nop'ed in native builds, but enabled in emcc builds (so wasm.js works). * WebAssembly lacks global variables, so `asm2wasm` maps them onto addresses in memory. This requires that you have some reserved space for those variables. You can do that with `emcc -s GLOBAL_BASE=1000`. We still need to write the code to copy the globals there. * Memory section needs the right size. diff --git a/src/asm2wasm.h b/src/asm2wasm.h index e2b853a07..c8dd3f9dd 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -787,13 +787,14 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { } Call* ret; if (wasm.imports.find(name) != wasm.imports.end()) { +#ifndef __EMSCRIPTEN__ // no imports yet in reference interpreter, fake it AsmType asmType = detectAsmType(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 +#else ret = allocator.alloc<CallImport>(); noteImportedFunctionCall(ast, astStackHelper.getParent(), &asmData); #endif |