* experimental: give listener r/o view of globals
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* experimental: add global support to interpreter
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* exp: replace globals proxy with module interface
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* exp: trim down experimental.InternalModule
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Replace globals view slice with constantGlobal
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Fix tests after merge
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Address PR feedback
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Rename methods of experimental.Module
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Run make check
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
* Add WazeroOnlyType to constantGlobal
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
---------
Signed-off-by: Thomas Pelletier <thomas@pelletier.codes>
This adds an internal function `wasm.SplitCallStack` for use in #1407.
This is separate because the diff is a lot larger than the destination
change ;)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This adds a new type `internalapi.WazeroOnly` which should be embedded on types users are likely to accidentally implement despite docs saying otherwise.
Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
This changes file descriptors from uint32 to int32 and the
corresponding file table to reject negative values. This ensures
invalid values aren't mistaken for very large descriptor entries, which
can use a lot of memory as the table implementation isn't designed to
be sparse.
See https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html#tag_16_90
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This adds emscripten.InstantiateForModule into the experimental package.
This builds dynamic invoke exports in the same order and only matching
those needed by the importing modules.
Finally, this removes special casing of function type IDs by deferring
resolution of them only in Emscripten.
Fixes#1364
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This makes host functions index consistently on insertion order, rather
than lexicographic order. This helps with ABI such as Emscripten, which
need an expected order.
This also constrains the internal code around host functions to only one
export name. More than one was never used. By restricting this, logic is
simpler and smaller.
Signed-off-by: Adrian Cole <adrian@tetrate.io>
ModuleInstance.Closed is an atomic variable meant to be loaded and
swapped with sync/atomic. Closed, being a 64 bit integer, requires 64
bit alignment. The simplest way we can get alignment is to place these
atomic fields at the top of their struct.
Closed can be moved to a more logical place once support for Go 1.18 is
dropped and its type changed to atomic.Uint64.
Signed-off-by: Tristan Willy <tristan.willy@gmail.com>
This removes the generally frowned upon practice of dot imports by
shortening the name of internal/wasi_snapshot_preview1 to
internal/wasip1. This leaves the external one alone as it would break
users to change it.
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This forces all syscall functions, notably filesystem, to return numeric
codes as opposed to mapping in two different areas. The result of this
change is better consolidation in call sites of `sysfs.FS`, while
further refactoring is needed to address consolidation of file errors.
Signed-off-by: Adrian Cole <adrian@tetrate.io>