summaryrefslogtreecommitdiff
path: root/src/wasm-shell.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-04 18:01:09 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-04 18:01:09 -0800
commit8ba70395b294b8525f52c511054ca95eef1f2686 (patch)
tree87dd08760a0ce96abf84bcabfab98d88cb94d4f5 /src/wasm-shell.cpp
parent8272166eb79bfff9e7aab73af125085ea7198b46 (diff)
downloadbinaryen-8ba70395b294b8525f52c511054ca95eef1f2686.tar.gz
binaryen-8ba70395b294b8525f52c511054ca95eef1f2686.tar.bz2
binaryen-8ba70395b294b8525f52c511054ca95eef1f2686.zip
write segments into memory, and parse all lines of functions
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;