diff options
Diffstat (limited to 'src/wasm/wasm-emscripten.cpp')
-rw-r--r-- | src/wasm/wasm-emscripten.cpp | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp index b18fe0c76..88e66ea07 100644 --- a/src/wasm/wasm-emscripten.cpp +++ b/src/wasm/wasm-emscripten.cpp @@ -156,19 +156,9 @@ Function* EmscriptenGlueGenerator::generateMemoryGrowthFunction() { return growFunction; } -void EmscriptenGlueGenerator::generateStackInitialization() { - // Replace a global with a constant initial value with an imported - // initial value, which emscripten JS will send us. - // TODO: with mutable imported globals, we can avoid adding another - // global for the import. - Builder builder(wasm); - auto* import = builder.makeGlobal(STACK_INIT, i32, nullptr, Builder::Immutable); - import->module = ENV; - import->base = STACKTOP; - wasm.addGlobal(import); +void EmscriptenGlueGenerator::generateStackInitialization(Address addr) { auto* stackPointer = getStackPointerGlobal(); - assert(stackPointer->init->is<Const>()); - stackPointer->init = builder.makeGetGlobal(import->name, i32); + stackPointer->init->cast<Const>()->value = Literal(int32_t(addr)); } static bool hasI64ResultOrParam(FunctionType* ft) { |