summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 5d88b8f38..588754580 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -33,7 +33,8 @@ IString GLOBAL("global"), NAN_("NaN"), INFINITY_("Infinity"),
FROUND("fround"),
ASM2WASM("asm2wasm"),
F64_REM("f64-rem"),
- F64_TO_INT("f64-to-int");
+ F64_TO_INT("f64-to-int"),
+ DEBUGGER("debugger");
static void abort_on(std::string why) {
@@ -758,6 +759,23 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
ret->type = asmToWasmType(asmData.getType(name));
return ret;
}
+ if (name == DEBUGGER) {
+ CallImport *call = allocator.alloc<CallImport>();
+ call->target = DEBUGGER;
+ call->type = none;
+ static bool addedImport = false;
+ if (!addedImport) {
+ addedImport = true;
+ auto import = allocator.alloc<Import>(); // debugger = asm2wasm.debugger;
+ import->name = DEBUGGER;
+ import->module = ASM2WASM;
+ import->base = DEBUGGER;
+ import->type.name = DEBUGGER;
+ import->type.result = none;
+ wasm.addImport(import);
+ }
+ return call;
+ }
// global var, do a load from memory
assert(mappedGlobals.find(name) != mappedGlobals.end());
MappedGlobal global = mappedGlobals[name];