diff options
author | Derek Schuff <dschuff@chromium.org> | 2016-03-09 17:38:56 -0800 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2016-03-09 17:38:56 -0800 |
commit | 864fa9c37ba1b33605805d89ab920e6fa4e67a38 (patch) | |
tree | c2cb837f4285b06b47bbb017a909df718673b7c1 /src/wasm.h | |
parent | e9d98deed872a72a826f78c8525464c446c6f21b (diff) | |
parent | ac9d61d45fec988640b57dc6b9de97e7d46c41f5 (diff) | |
download | binaryen-864fa9c37ba1b33605805d89ab920e6fa4e67a38.tar.gz binaryen-864fa9c37ba1b33605805d89ab920e6fa4e67a38.tar.bz2 binaryen-864fa9c37ba1b33605805d89ab920e6fa4e67a38.zip |
Merge pull request #225 from WebAssembly/memory_pages
Make initial and max memory sizes be in pages instead of bytes
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/wasm.h b/src/wasm.h index 6cbe93e3b..4bcb4bc87 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -503,6 +503,20 @@ public: default: WASM_UNREACHABLE(); } } + Literal rotL(const Literal& other) const { + switch (type) { + case WasmType::i32: return Literal(RotateLeft(uint32_t(i32), uint32_t(other.i32))); + case WasmType::i64: return Literal(RotateLeft(uint64_t(i64), uint64_t(other.i64))); + default: WASM_UNREACHABLE(); + } + } + Literal rotR(const Literal& other) const { + switch (type) { + case WasmType::i32: return Literal(RotateRight(uint32_t(i32), uint32_t(other.i32))); + case WasmType::i64: return Literal(RotateRight(uint64_t(i64), uint64_t(other.i64))); + default: WASM_UNREACHABLE(); + } + } Literal eq(const Literal& other) const { switch (type) { @@ -676,7 +690,7 @@ enum UnaryOp { enum BinaryOp { Add, Sub, Mul, // int or float - DivS, DivU, RemS, RemU, And, Or, Xor, Shl, ShrU, ShrS, // int + DivS, DivU, RemS, RemU, And, Or, Xor, Shl, ShrU, ShrS, RotL, RotR, // int Div, CopySign, Min, Max, // float // relational ops Eq, Ne, // int or float @@ -1074,6 +1088,8 @@ public: class Memory { public: + static const size_t kPageSize = 64 * 1024; + static const size_t kPageMask = ~(kPageSize - 1); struct Segment { size_t offset; const char* data; @@ -1082,7 +1098,7 @@ public: Segment(size_t offset, const char *data, size_t size) : offset(offset), data(data), size(size) {} }; - size_t initial, max; + size_t initial, max; // sizes are in pages std::vector<Segment> segments; Memory() : initial(0), max((uint32_t)-1) {} |