| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Fixes #2139
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes wasm2c serialize each function type, rather than registering
function types at module-initialization time. The serialized function
type is the SHA-256 of the mangled param and result types (with a space
between params and results).
At runtime in call_indirect, a known (immediate) function type is
compared against the function type stored in a funcref structure. For
call_indirects to functions local to the module, or for any
call_indirect when the toolchain merges string constants across
compilation units (generally, GCC and clang), this can be done by
comparing the pointers to each function type. Otherwise, the actual
32-byte values are compared.
The function type IDs can be looked up at runtime with
`Z_[modname]_get_func_type`, which matches the API from
`wasm_rt_register_func_type`. A new `callback` example demos this.
wasm2c does the SHA-256 either by linking against libcrypto or, if not
available or if requested via `cmake -DUSE_INTERNAL_SHA256=ON`, by using
a vendored (header-only) PicoSHA2. There is no runtime dependency on
SHA-256 in the wasm2c runtime or generated modules.
This eliminates the last of the per-module state, so this commit also removes
the [modname]_init_module() function and the s_module_initialized bool.
|
|
|
|
|
|
| |
I'm not sure this was ever needed. `__inline` and `inline` are
identical under msvc:
https://learn.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=msvc-170
"The __inline keyword is equivalent to inline"
|
| |
|
|
|
|
|
|
|
|
| |
This adds support for the new opcodes from the Relaxed SIMD proposal
(https://github.com/WebAssembly/relaxed-simd) behind the
"--enable-relaxed-simd" flag.
The exception is the f32x4.relaxed_dot_bf16x8_add_f32x4 instruction
which is not yet implemented.
|
| |
|
|
|
|
|
|
|
|
|
| |
Value's `type` field was compiled conditionally on the `NDEBUG` define.
This causes problems with programs compiling against libwabt that don't
define this macro, as the Value layout no longer matches.
Using a condition in config.h.
Fixes #2069
|
|
|
|
| |
This is more modern and (IMHO) easier to read than that old C typedef
syntax.
|
|
|
| |
IIUC this is preferred in modern C++ and expresses indent better.
|
| |
|
|
|
| |
Co-authored-by: Mitch Foley <mitchfoley@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As well as the testsuite update there are two notable changes that
come with it here. These can both be split out an landed first if
it makes sense.
1. wasm2c now supports element sections containing externref. Currently
only the null reference is supported.
2. element segments no longer use funcref as the default element type
but instead, unless explicitly included in the binary, the
element type defaults to the type of the table in which the segment
is active.
Fixes: #1612 #2022
|
|
|
|
|
|
|
|
| |
All of these checks represent cases where a validation error would
prevent the type mismatch.
When debugging #2054 this check actually worked against me since it
was resulting a false-positive "out-of-bound" error reports when really
it was an internal type inconsistency (a bug).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When both the multi-memory and memory64 features are enabled it's
possible for memory.copy to copy between two memories of different
types. In this case, the memory64 proposal specifies that the src and
dst arguments should correspond to the types of the memory they are
accessing, and the size argument should correspond to the "minimum" of
the two memory types [1]. That is, the size should be an i32 if either
of the memories has type i32 and it should be i64 if both of the
memories have type i64.
The existing code just expects all three arguments to match the type of
the source memory which works whenever the source and destination
memories have the same type. This change adjusts that logic to agree
with the memory64 proposal in the cases where the two memories have
differing types.
[1]
https://github.com/WebAssembly/memory64/blob/5bfb70d9888b96a2f3d6412ed3599b91364da610/proposals/memory64/Overview.md?plain=1#L211
|
|
|
|
|
| |
Simplify `CheckOpcode1` by avoiding using it for memory.fill.
Simplify and move GetMemoryParam.
|
|
|
|
|
| |
Also, make sure we test this configuration.
Fixes: #2016
|
|
|
|
|
| |
* Log all lexing errors in WastLexer (rather than via parser)
* Update docs/demo/libwabt.js
|
|
|
|
|
| |
* Update testsuite (adding new tokens.txt test)
* Adjust Wast lexing to match updated spec (WebAssembly/spec#1499)
|
|
This makes things easier for users and packagers of libwabt.
|