summaryrefslogtreecommitdiff
path: root/src/asm2wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/asm2wasm.h')
-rw-r--r--src/asm2wasm.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index db7cc1ae0..11cb75b30 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -33,8 +33,6 @@ namespace wasm {
using namespace cashew;
-extern int debug; // wasm::debug is set in main(), typically from an env var
-
// Utilities
static void abort_on(std::string why, Ref element) {
@@ -151,6 +149,7 @@ class Asm2WasmBuilder {
std::map<CallIndirect*, IString> callIndirects; // track these, as we need to fix them after we know the functionTableStarts. this maps call => its function table
bool memoryGrowth;
+ int debug;
public:
std::map<IString, MappedGlobal> mappedGlobals;
@@ -267,10 +266,16 @@ private:
}
public:
- Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth) : wasm(wasm), allocator(wasm.allocator), nextGlobal(8), maxGlobal(1000), memoryGrowth(memoryGrowth) {}
-
- void processAsm(Ref ast);
- void optimize();
+ Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth, int debug)
+ : wasm(wasm),
+ allocator(wasm.allocator),
+ nextGlobal(8),
+ maxGlobal(1000),
+ memoryGrowth(memoryGrowth),
+ debug(debug) {}
+
+ void processAsm(Ref ast);
+ void optimize();
private:
AsmType detectAsmType(Ref ast, AsmData *data) {