From fa6af8657d6d85f3daa7788df011930a080ab5f2 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 29 Apr 2016 08:39:18 -0500 Subject: merge binary_0xb (#675) * Merge pull request #648 from WebAssembly/current_memory Add current_memory operator * Reorder section size field (#639) * Prettify section names (#638) * Extensible encoding of function signatures (#640) * Prettify section names * Restructure encoding of function signatures * Revert "[Binary 11] Update the version number to 0xB." * Leave index space for growing the number of base types * Comments addressed * clarify how export/import names convert to JS strings (#569) (#573) * When embedded in the web, clarify how export/import names convert to JS strings (#569) * Fixes suggested by @jf * Address more feedback Added a link to http://monsur.hossa.in/2012/07/20/utf-8-in-javascript.html. Simplified the decoding algorithm thanks to Luke's feedback. * Access to proprietary APIs apart from HTML5 (#656) * comments * Merge pull request #641 from WebAssembly/postorder_opcodes Postorder opcodes * fix some text that seems to be in the wrong order (#670) * Clarify that br_table has a branch argument (#664) * Add explicit argument counts (#672) * Add explicit arities * Rename * Replace uint8 with varint7 in form field (#662) This needs to be variable-length. --- AstSemantics.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'AstSemantics.md') diff --git a/AstSemantics.md b/AstSemantics.md index 0d230be..f354c4a 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -82,19 +82,20 @@ operators. The main storage of a WebAssembly instance, called the *linear memory*, is a contiguous, byte-addressable range of memory spanning from offset `0` and -extending for `memory_size` bytes which can be dynamically grown by -[`grow_memory`](AstSemantics.md#resizing). The linear memory can be considered +extending up to a varying *memory size*. +This size always is a multiple of the WebAssembly page size, +which is 64KiB on all engines (though large page support may be added in the +[future](FutureFeatures.md#large-page-support)). +The initial state of linear memory is specified by the +[module](Modules.md#linear-memory-section), and it can be dynamically grown by +the [`grow_memory`](AstSemantics.md#resizing) operator. + +The linear memory can be considered to be an untyped array of bytes, and it is unspecified how embedders map this array into their process' own [virtual memory][]. The linear memory is sandboxed; it does not alias the execution engine's internal data structures, the execution stack, local variables, or other process memory. -The initial state of linear memory is specified by the -[module](Modules.md#linear-memory-section). The initial and maximum memory size -are required to be a multiple of the WebAssembly page size, which is 64KiB on -all engines (though large page support may be added in the -[future](FutureFeatures.md#large-page-support)). - [virtual memory]: https://en.wikipedia.org/wiki/Virtual_memory In the MVP, linear memory is not shared between threads of execution. Separate @@ -152,7 +153,7 @@ interpreted as an unsigned byte index. Linear memory operators access the bytes starting at the effective address and extend for the number of bytes implied by the storage size. If any of the -accessed bytes are beyond `memory_size`, the access is considered +accessed bytes are beyond the current memory size, the access is considered *out-of-bounds*. The use of infinite-precision in the effective address computation means that @@ -215,6 +216,10 @@ reserve the space up front or if enabling the reserved memory fails. When there is no maximum memory size declared, `grow_memory` is expected to perform a system allocation which may fail. +The current size of the linear memory can be queried by the following operator: + + * `current_memory` : return the current memory size in units of pages. + As stated [above](AstSemantics.md#linear-memory), linear memory is contiguous, meaning there are no "holes" in the linear address space. After the MVP, there are [future features](FutureFeatures.md#finer-grained-control-over-memory) -- cgit v1.2.3