summaryrefslogtreecommitdiff
path: root/src/wasm-shell.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-06 09:08:21 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-06 09:08:21 -0800
commit38b6e18b5b563ee235f426d695a89c20cb08ada5 (patch)
treefaf22c0d978f783e359244c2b961385551db4ec6 /src/wasm-shell.cpp
parent034596930c9d4ca3e771e78e03e06efc026fadff (diff)
downloadbinaryen-38b6e18b5b563ee235f426d695a89c20cb08ada5.tar.gz
binaryen-38b6e18b5b563ee235f426d695a89c20cb08ada5.tar.bz2
binaryen-38b6e18b5b563ee235f426d695a89c20cb08ada5.zip
host ops
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 {