Skip to content

Commit babaf50

Browse files
committed
Merge pull request #296 from WebAssembly/constrain-page-size
Elaborate on the semantics of `page_size`.
2 parents 47d9ffa + 618fc54 commit babaf50

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

AstSemantics.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,21 @@ page size. To determine page size, a nullary `page_size` operation is provided.
222222

223223
* `resize_memory` : grow or shrink linear memory by a given delta which
224224
must be a multiple of `page_size`
225-
* `page_size` : nullary constant function returning page size
225+
* `page_size` : nullary constant function returning page size in bytes
226226

227227
Also as stated [above](AstSemantics.md#linear-memory), linear memory is
228228
contiguous, meaning there are no "holes" in the linear address space. After the
229229
MVP, there are [future features](FutureFeatures.md#finer-grained-control-over-memory)
230230
proposed to allow setting protection and creating mappings within the
231231
contiguous linear memory.
232232

233+
The result type of `page_size` is `int32` for wasm32 and `int64` for wasm64.
234+
The result value of `page_size` is an unsigned integer which is a power of 2.
235+
236+
(Note that the `page_size` value need not reflect the actual internal page size
237+
of the implementation; it just needs to be a value suitable for use with
238+
`resize_memory`)
239+
233240
## Local variables
234241

235242
Each function has a fixed, pre-declared number of local variables which occupy a single

0 commit comments

Comments
 (0)