diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 19:08:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-05 19:08:02 -0800 |
commit | 0500af8981f03982aa68bee6d28e3ad339c01e28 (patch) | |
tree | adf31f698ebd9fdff7323deee21171ef3e39c8cd /src/wasm-interpreter.h | |
parent | 2b314faa4c50738473f977dcf9adae3708363e16 (diff) | |
download | binaryen-0500af8981f03982aa68bee6d28e3ad339c01e28.tar.gz binaryen-0500af8981f03982aa68bee6d28e3ad339c01e28.tar.bz2 binaryen-0500af8981f03982aa68bee6d28e3ad339c01e28.zip |
has_feature
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index c4bf21d54..7b8812d69 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -15,6 +15,8 @@ using namespace cashew; // An instance of a WebAssembly module, which can execute it via AST interpretation // +IString WASM("wasm"); + class ModuleInstance { public: typedef std::vector<Literal> LiteralList; @@ -562,7 +564,18 @@ public: } Flow visitHost(Host *curr) override { NOTE_ENTER("Host"); - abort(); + + switch (curr->op) { + case PageSize: return Literal(64*1024); + case MemorySize: return Literal(instance.memorySize); + case GrowMemory: abort(); + case HasFeature: { + IString id = curr->nameOperand; + if (id == WASM) return Literal(1); + return Literal(0); + } + default: abort(); + } } Flow visitNop(Nop *curr) override { NOTE_ENTER("Nop"); |