summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-03-04 17:09:47 -0800
committerDerek Schuff <dschuff@chromium.org>2016-03-09 13:04:18 -0800
commit1b45938aadd6e03e9210d88436be9c393623fb42 (patch)
tree24028248c7b9999a8d46bbab913fbe460d76bc46 /src/wasm.h
parente9d98deed872a72a826f78c8525464c446c6f21b (diff)
downloadbinaryen-1b45938aadd6e03e9210d88436be9c393623fb42.tar.gz
binaryen-1b45938aadd6e03e9210d88436be9c393623fb42.tar.bz2
binaryen-1b45938aadd6e03e9210d88436be9c393623fb42.zip
Make initial and max memory sizes be in pages instead of bytes
The AST and everything that uses it treats the values as pages. Javascript continues to use bytes. This matches v8 and sexpr-wasm, and the consensus from live discussion and PR209 in the spec.
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 6cbe93e3b..ce6b9d294 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -1074,6 +1074,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 +1084,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) {}