diff options
| author | Luke Wagner <luke@mozilla.com> | 2015-08-04 09:02:31 -1000 |
|---|---|---|
| committer | Luke Wagner <luke@mozilla.com> | 2015-08-12 08:23:30 -1000 |
| commit | 0ef4e93fe3bea4356fdee2c647b2dbc54cc2d3d0 (patch) | |
| tree | bd5c34722418d06b44762d3fad7727354726f62f /AstSemantics.md | |
| parent | 87c01bd0840c08aba4f233985194b1070660d592 (diff) | |
| download | nanowasm-design-0ef4e93fe3bea4356fdee2c647b2dbc54cc2d3d0.tar.gz | |
Clarify, rename, and FAQ memory allocation
Diffstat (limited to 'AstSemantics.md')
| -rw-r--r-- | AstSemantics.md | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/AstSemantics.md b/AstSemantics.md index 35f71b2..9bba34e 100644 --- a/AstSemantics.md +++ b/AstSemantics.md @@ -71,17 +71,18 @@ Global variables and linear memory accesses use memory types. The main storage of a WebAssembly module, called the *linear memory*, is a contiguous, byte-addressable range of memory spanning from offset `0` and -extending for `memory_size` bytes. The linear memory can be considered to be a -untyped array of bytes. The linear memory is sandboxed; it does not alias the -execution engine's internal data structures, the execution stack, local +extending for `memory_size` bytes which can be dynamically adjusted by +[`resize_memory`](Modules.md#resizing). The linear memory can be considered to +be an untyped array of bytes. The linear memory is sandboxed; it does not alias +the execution engine's internal data structures, the execution stack, local variables, global variables, or other process memory. The initial state of linear memory is specified by the [module](Modules.md#initial-state-of-linear-memory). -In the MVP, linear memory is not shared between threads of execution or -modules: every module has its own separate linear memory. It will, -however, be possible to share linear memory between separate modules and -threads once [threads](PostMVP.md#threads) and -[dynamic linking](FutureFeatures.md#dynamic-inking) are added as features. +In the MVP, linear memory is not shared between threads of execution. Separate +modules can execute in separate threads but have their own linear memory and can +only communicate through messaging, e.g. in browsers using `postMessage`. It +will be possible to share linear memory between threads of execution when +[threads](PostMVP.md#threads) are added. ### Linear Memory Operations @@ -210,6 +211,17 @@ tradeoffs. execution of a module in a mode that threw exceptions on out-of-bounds access. +### Resizing + +As stated [above](AstSemantics.md#linear-memory), linear memory can be resized +by a `resize_memory` builtin operation. The resize delta is required to be a +multiple of a global `page_size` constant. Also 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) proposed +to allow setting protection and creating mappings within the contiguous +linear memory. + ## Local variables Each function has a fixed, pre-declared number of local variables which occupy a single |
