diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-16 09:40:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-16 09:40:59 -0700 |
commit | e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb (patch) | |
tree | 834f67d6ebaf295af0e1d6789bc7f52d120dff33 /src/wasm.h | |
parent | e268d939b86d8639d014b8036e7664d66b6a32e9 (diff) | |
parent | 7851e3a7a3bea679f422116862c5801f1938806d (diff) | |
download | binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.gz binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.tar.bz2 binaryen-e5e3bf39f25ed3a2fb45a9ca1f55d6828d81a3eb.zip |
Merge pull request #668 from WebAssembly/tables_n_memories
Tables and memories
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/wasm.h b/src/wasm.h index 38a030e1a..68558033d 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -1432,7 +1432,23 @@ public: class Table { public: - std::vector<Name> names; + static const Index kMaxSize = Index(-1); + + struct Segment { + Expression* offset; + std::vector<Name> data; + Segment() {} + Segment(Expression* offset) : offset(offset) { + } + Segment(Expression* offset, std::vector<Name>& init) : offset(offset) { + data.swap(init); + } + }; + + Address initial, max; + std::vector<Segment> segments; + + Table() : initial(0), max(kMaxSize) {} }; class Memory { @@ -1440,15 +1456,16 @@ public: static const Address::address_t kPageSize = 64 * 1024; static const Address::address_t kMaxSize = ~Address::address_t(0) / kPageSize; static const Address::address_t kPageMask = ~(kPageSize - 1); + struct Segment { - Address offset; + Expression* offset; std::vector<char> data; // TODO: optimize Segment() {} - Segment(Address offset, const char *init, Address size) : offset(offset) { + Segment(Expression* offset, const char *init, Address size) : offset(offset) { data.resize(size); std::copy_n(init, size, data.begin()); } - Segment(Address offset, std::vector<char>& init) : offset(offset) { + Segment(Expression* offset, std::vector<char>& init) : offset(offset) { data.swap(init); } }; |