From 8ba70395b294b8525f52c511054ca95eef1f2686 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 4 Nov 2015 18:01:09 -0800 Subject: write segments into memory, and parse all lines of functions --- src/wasm-shell.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/wasm-shell.cpp') 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; -- cgit v1.2.3