summaryrefslogtreecommitdiff
path: root/src/wasm-shell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-shell.cpp')
-rw-r--r--src/wasm-shell.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp
index c37ba79a3..5f9fafd8f 100644
--- a/src/wasm-shell.cpp
+++ b/src/wasm-shell.cpp
@@ -24,13 +24,11 @@ IString ASSERT_RETURN("assert_return"),
struct ShellExternalInterface : ModuleInstance::ExternalInterface {
char *memory;
- size_t memorySize;
ShellExternalInterface() : memory(nullptr) {}
void init(Module& wasm) override {
memory = new char[wasm.memory.initial];
- memorySize = wasm.memory.initial;
// apply memory segments
for (auto segment : wasm.memory.segments) {
memcpy(memory + segment.offset, segment.data, segment.size);
@@ -104,6 +102,11 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
}
}
+ void growMemory(size_t oldSize, size_t newSize) override {
+ delete memory;
+ memory = new char[newSize];
+ }
+
jmp_buf trapState;
void trap() override {