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.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm-shell.cpp b/src/wasm-shell.cpp
index 7fe05851d..1ad0a19ad 100644
--- a/src/wasm-shell.cpp
+++ b/src/wasm-shell.cpp
@@ -29,6 +29,10 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
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);
+ }
}
jmp_buf trapState;