summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Add ARM64 windows compatibility (#2140)Changqing Jing2023-02-091-2/+2
| | | Fixes #2139
* wasm2c: serialize types at wasm2c-time (#2120)Keith Winstein2023-01-251-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use inline keyword over WABT_INLINE. NFC (#2092)Sam Clegg2022-12-022-4/+4
| | | | | | 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"
* Reduce code duplication in MemcpyEndianAware definition. NFC (#2087)Sam Clegg2022-12-012-20/+12
|
* Implement Relaxed SIMD proposal (#1994)Marcus Better2022-11-308-8/+92
| | | | | | | | 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.
* wasm2c: handle duplicate names across module fields (#2035)Keith Winstein2022-11-301-1/+1
|
* interp: Replace condition for including `type` field in `Value` (#2071)Remko Tronçon2022-11-161-1/+2
| | | | | | | | | 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
* Switch from `typedef` to using `using` in C++ code. NFC (#2066)Sam Clegg2022-11-1511-112/+112
| | | | This is more modern and (IMHO) easier to read than that old C typedef syntax.
* Prefer `constexpr` over `static const`. NFC (#2065)Sam Clegg2022-11-159-19/+19
| | | IIUC this is preferred in modern C++ and expresses indent better.
* Use C++ versions of standard headers. NFC (#2064)Sam Clegg2022-11-154-6/+6
|
* add missing include (#2063)walkingeyerobot2022-11-151-0/+1
| | | Co-authored-by: Mitch Foley <mitchfoley@chromium.org>
* Update testsuite (#2054)Sam Clegg2022-11-131-2/+5
| | | | | | | | | | | | | | | 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
* Convert type checks to assertions in the interpreter. NFC (#2055)Sam Clegg2022-11-111-1/+1
| | | | | | | | 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).
* Align `memory.copy` arg types with `memory64` proposal (#2024)Adam Bratschi-Kaye2022-11-011-1/+1
| | | | | | | | | | | | | | | | | | | 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 part of type-checker. NFC (#2031)Sam Clegg2022-10-312-11/+1
| | | | | Simplify `CheckOpcode1` by avoiding using it for memory.fill. Simplify and move GetMemoryParam.
* Fix WITH_WASI build (#2017)Sam Clegg2022-10-061-28/+0
| | | | | Also, make sure we test this configuration. Fixes: #2016
* WastLexer: log lexing errors directly (#2013)Keith Winstein2022-10-031-6/+12
| | | | | * Log all lexing errors in WastLexer (rather than via parser) * Update docs/demo/libwabt.js
* Add tokens test + adjust Wast lexing to match updated spec (#2001)Keith Winstein2022-10-031-4/+8
| | | | | * Update testsuite (adding new tokens.txt test) * Adjust Wast lexing to match updated spec (WebAssembly/spec#1499)
* Move headers to include/wabt/ (#1998)Alex Reinking2022-09-2865-0/+12859
This makes things easier for users and packagers of libwabt.