Skip to content

Commit

Permalink
remove sbrk from MVP, add mmap&friends to AstSemantics
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Jul 28, 2015
1 parent f74c4a8 commit aa38660
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
29 changes: 25 additions & 4 deletions AstSemantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ memory storage indexed by the effective address, and extending for the number
of bytes implied by the memory type attribute of the access.

If any of the accessed bytes are beyond `memory_size`, the access is considered
*out-of-bounds*. A module may optionally define that out-of-bounds includes
small effective addresses close to `0`
(see [discussion](https://github.com/WebAssembly/design/issues/204)).
The semantics of out-of-bounds accesses are discussed
*out-of-bounds*. The semantics of out-of-bounds accesses are discussed
[below](AstSemantics.md#out-of-bounds).

The use of infinite-precision in the effective address computation means that
Expand All @@ -154,6 +151,30 @@ by [available resources](Nondeterminism.md)). In the future, to support
[>4GiB linear memory](FutureFeatures.md#heaps-bigger-than-4gib), support for
indices with type `int64` will be added.

### Adjusting memory size and permissions: `mmap`

In the MVP the size of linear memory is fixed: The initial size of linear
memory will remain unchanged for the life of that WebAssembly module. Later,
we will support a limited form of `mmap` which can:

* Allocate pages of memory, in order to increase or decrease
the amount of available memory to the WebAssembly module.
* Adjust the permissions of a page of memory, for example to make
small effective addresses close to `0` behave as if they are
[out-of-bounds](AstSemantics.md#out-of-bounds)
(see [discussion](https://github.com/WebAssembly/design/issues/204)).

In addition to the `mmap` operation, applications will also have access to

* `munmap`, to unmap `mmap`ed pages, and
* `mmap_get_page_size`, to detect the system page size (this may not
provide accurate information about the underlying system, but it
should be good enough for purposes of calling `mmap`).

In the future,
[further `mmap` functionality](FutureFeatures.md#finer-grained-control-over-memory)
may be added.

### Alignment

Each linear memory access operation also has an immediate positive integer power
Expand Down
1 change: 0 additions & 1 deletion MVP.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ isomorphic to the [binary format](BinaryEncoding.md).
necessary for two WebAssembly modules to share the same linear memory.
* Modules can specify memory size and initialization data (`data`, `rodata`,
`bss`) in the [memory-initialization section](MVP.md#module-structure).
* Modules can specify whether memory is growable (via `sbrk`).
* Modules can optionally export memory, allowing it to be aliased by the
embedder, such as JavaScript:
* JavaScript sees the exported memory as an `ArrayBuffer`.
Expand Down

0 comments on commit aa38660

Please sign in to comment.