From f428a6d069543a4341a87bf84f7c6263f8a91f62 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Aug 2015 09:49:25 -0700 Subject: [PATCH 1/6] Elaborate on the semantics of `page_size`. --- AstSemantics.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AstSemantics.md b/AstSemantics.md index bc21c3de..2b47ec28 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -227,6 +227,11 @@ MVP, there are [future features](FutureFeatures.md#finer-grained-control-over-me proposed to allow setting protection and creating mappings within the contiguous linear memory. +In the MVP, the result type of `page_size` is `int32`; in the future, support +support for page sizes requiring a type of `int64` may be added. The page size +is an unsigned integer which is a power of 2 and at least 1024. `page_size` +traps if the actual page size cannot be represented under these constraints. + ## Local variables Each function has a fixed, pre-declared number of local variables which occupy a single From 9f89d88190b800fa0b7590dd2c3acfed502610ed Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Aug 2015 10:09:41 -0700 Subject: [PATCH 2/6] Clarify that page sizes are in bytes. --- AstSemantics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AstSemantics.md b/AstSemantics.md index 2b47ec28..2848fb77 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -219,7 +219,7 @@ page size. To determine page size, a nullary `page_size` operation is provided. * `resize_memory` : grow or shrink linear memory by a given delta which must be a multiple of `page_size` - * `page_size` : nullary constant function returning page size + * `page_size` : nullary constant function returning page size in bytes Also as stated [above](AstSemantics.md#linear-memory), linear memory is contiguous, meaning there are no "holes" in the linear address space. After the From f866601eeae4aa7d6134fa0a9eb16e9f9e2a005d Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Aug 2015 10:09:52 -0700 Subject: [PATCH 3/6] Add a note that page sizes may be virtual. --- AstSemantics.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AstSemantics.md b/AstSemantics.md index 2848fb77..4a619fe7 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -232,6 +232,10 @@ support for page sizes requiring a type of `int64` may be added. The page size is an unsigned integer which is a power of 2 and at least 1024. `page_size` traps if the actual page size cannot be represented under these constraints. +(Note that the `page_size` value need not reflect the actual internal page size +of the implementation; it just needs to be a value suitable for use with +`resize_memory`) + ## Local variables Each function has a fixed, pre-declared number of local variables which occupy a single From 02a3fe1e0f498b7771be564d9dacc76317361ee8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 13 Aug 2015 10:46:41 -0700 Subject: [PATCH 4/6] Drop the minimum page size. --- AstSemantics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 4a619fe7..7c99425f 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -229,8 +229,8 @@ contiguous linear memory. In the MVP, the result type of `page_size` is `int32`; in the future, support support for page sizes requiring a type of `int64` may be added. The page size -is an unsigned integer which is a power of 2 and at least 1024. `page_size` -traps if the actual page size cannot be represented under these constraints. +is an unsigned integer which is a power of 2. `page_size` traps if the actual +page size cannot be represented under these constraints. (Note that the `page_size` value need not reflect the actual internal page size of the implementation; it just needs to be a value suitable for use with From 88d6193bd727f09bef72e852301ebaa95967daae Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 17 Sep 2015 07:46:23 -0700 Subject: [PATCH 5/6] Remove the sentance about page_size trapping. --- AstSemantics.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 7c99425f..34ba8f91 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -229,8 +229,7 @@ contiguous linear memory. In the MVP, the result type of `page_size` is `int32`; in the future, support support for page sizes requiring a type of `int64` may be added. The page size -is an unsigned integer which is a power of 2. `page_size` traps if the actual -page size cannot be represented under these constraints. +is an unsigned integer which is a power of 2. (Note that the `page_size` value need not reflect the actual internal page size of the implementation; it just needs to be a value suitable for use with From 618fc5407b49acbaa3b7f143fd799c781b490cde Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 17 Sep 2015 07:48:36 -0700 Subject: [PATCH 6/6] Simplify the description of page_size's type and result value. --- AstSemantics.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/AstSemantics.md b/AstSemantics.md index 34ba8f91..7062a8ff 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -227,9 +227,8 @@ MVP, there are [future features](FutureFeatures.md#finer-grained-control-over-me proposed to allow setting protection and creating mappings within the contiguous linear memory. -In the MVP, the result type of `page_size` is `int32`; in the future, support -support for page sizes requiring a type of `int64` may be added. The page size -is an unsigned integer which is a power of 2. +The result type of `page_size` is `int32` for wasm32 and `int64` for wasm64. +The result value of `page_size` is an unsigned integer which is a power of 2. (Note that the `page_size` value need not reflect the actual internal page size of the implementation; it just needs to be a value suitable for use with