summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use C++17's [[fallthrough]]. NFC (#2091)Sam Clegg2023-02-275-17/+20
|
* Improve lexing of invalid annotations (#2150)Keith Winstein2023-02-252-1/+13
| | | | | | | | | This had been crashing even with annotations disabled. Adds a regression test. This was missed in #2001 when updating the lexer to match the updated spec (WebAssembly/spec#1499). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53935
* c-writer.cc: omit dummy_member in one case where it was unnecessary (NFC) ↵Keith Winstein2023-02-251-1/+1
| | | | (#2149)
* wasm2c: cap blank lines between sections (NFC) (#2148)Keith Winstein2023-02-254-13/+22
|
* c-writer.cc: sanitize module/field names for use in C comments (NFC) (#2147)Keith Winstein2023-02-252-7/+901
|
* wasm2c: prettify/change name mangling (#2142)Keith Winstein2023-02-2313-368/+528
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * wasm2c: prettify/change name-mangling This refactors the wasm2c name-mangling in two big ways: 1) Removing the `Z_` prefix and trying to make the names somewhat ergonomic/pretty. Previously the `factorial` export from a `fac` module looked like this: ``` u32 Z_facZ_factorial(Z_fac_instance_t*, u32); ``` After this commit, it looks like this: ``` u32 w2c_fac_factorial(w2c_fac*, u32); ``` Symbols defined by wasm2c itself (including instantiate, free, get_func_type and the imported memory limits) are now prefixed with `wasm2c_` to avoid conflicting with names defined by the module. 2) Using globally unique (module-prefixed) names for functions, types, segments, and tags, even though they are currently static (internal-linkage) symbols in the .c output. This is preparation for a future "multiple .c output" option where these symbols will need to have external linkage.
* objdump: take care of opcodes whose bytes are non-canonical leb128 (#1632)Ng Zhi An2023-02-132-1/+43
| | | Fixes #1631
* wasm-strip: Add `-k/--keep-section` flag to prevent sections with specific ↵Surma2023-02-092-2/+61
| | | | names from getting stripped (#2143)
* Add ARM64 windows compatibility (#2140)Changqing Jing2023-02-093-6/+32
| | | Fixes #2139
* wasm2c: handle duplicate names between params/locals and labels (NFC) (#2137)Keith Winstein2023-02-072-33/+73
| | | | Fixes #2136
* wasm2c: add SIMD support (#2119)Willy R. Vasquez2023-01-2968-75/+2031
| | | This change incorporates [simd-everywhere](https://github.com/simd-everywhere/simde) into the wasm2c output, which maps wasm SIMD C intrinsics to any supported target architecture.
* Speed up tests by matrixing asan/ubsan x debug/release (#2081)Keith Winstein2023-01-272-29/+23
| | | Will shorten the critical path after wasm2c is running SIMD tests
* Make wasm2c output UBSAN-clean (and run w2c CI w/ UBSAN) (#2080)Keith Winstein2023-01-286-11/+41
| | | | | | We had been running the GitHub UBSAN wasm2c tests with -fsanitize=undefined but without -fno-sanitize-recover, meaning some of the spec tests were printing UBSAN error messages but still returning 0, so we weren't seeing the test failures.
* Rename before_args to after_argsKeith Winstein2023-01-252-5/+4
|
* wasm2c: move WASM2C_CFLAGS to end of compiler command lineKeith Winstein2023-01-252-3/+3
| | | | This allows overriding flags like -O2 by appending -O0 from the env var.
* wasm2c: serialize types at wasm2c-time (#2120)Keith Winstein2023-01-2525-291/+528
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Update wasm2c examples to reflect new wasm_rt_allocate_memory() parameter ↵Keith Winstein2023-01-224-8/+21
| | | | (#2133)
* Fix wasm2c test runner (#2131)Sam Clegg2023-01-182-2/+7
| | | | I mistakenly broke the wasm2c test runner in #2086. I guess we need tests for our test runner..
* wasm-rt.h: Use thread-local storage for traps/exceptions on MSVCKeith Winstein2023-01-161-1/+3
|
* Fix typo in binary-reader.cc (#2127)Tatsuyuki Kobayashi2023-01-141-4/+4
|
* wasm2c: Initial implementation of memory64 (#2086)Sam Clegg2023-01-1225-31/+177
| | | | | | | Note, there are still some issues here that needs to be resolved, mostly about memory sandboxing (bounds checking). Since this is still experimental I've also added a `--experimental` flag to wasm2c that is required in addition to passing `--enable-memory64`.
* wasm2c rt: mark temp storage for traps/exceptions as thread_local (#2126)Keith Winstein2023-01-123-10/+16
|
* wasm2c: eliminate wasm_rt_register_tag() (#2122)Keith Winstein2023-01-114-57/+27
| | | | This lets exception tags be pre-assigned, instead of making the runtime keep an incrementing counter.
* fix wasm2c tests on 32-bit (#2124)rathann2023-01-081-1/+1
| | | | The spectest_make_externref() in test/spec-wasm2c-prefix.c:203 assumed that u64 (uint64_t) can be converted to wasm_rt_externref_t (void *).
* wasm2c: harden set/longjmp to check for uninit jmp_bufShravan Narayan2023-01-033-12/+32
|
* Remove note on bfloat16 dot product instruction (#2115)Marcus Better2023-01-011-1/+1
| | | | The instruction was removed from the Relaxed SIMD spec, so this implementation is now up to date.
* wasm2c: mark manually formatted code in c-writerShravan Narayan2022-12-291-0/+8
| | | | Prevent clang-format from automatically changing manually formatted regions of code
* wasm2c: expose the initial and max size required from imported memoryShravan Narayan2022-12-291-8/+44
|
* Version 1.0.32 (#2111)Marcus Better2022-12-271-1/+1
|
* Enable features in libwabt.js by default (#2109)Marcus Better2022-12-277-77/+87
| | | | | | | | | | This applies the same defaults for features in the JavaScript-compiled version as the native tools. Without this change, enabling only the "reference_types" feature did not work, as it got turned off due to the dependency on "bulk_memory", which is counter-intuitive (see Features::UpdateDependencies()). Additionally, exposes all the features and their default setting in JavaScript.
* wast-parser.cc: disallow exception tag unless exceptions enabled (#2110)Keith Winstein2022-12-233-1/+16
|
* Add relaxed SIMD to wabt.js features (#2107)Marcus Better2022-12-222-0/+3
|
* Use flat format for emscriptnen exported function list. NFC (#2108)Sam Clegg2022-12-214-65/+59
|
* Typo in previous PR causing unbalanced braces (#2106)Thomas Tay2022-12-191-1/+1
| | | | Sorry, fixed now. Didn't balance my braces. Thats what you get for editing in the Github editor, opened this file in vscode with the fix now, and no problems reported
* wast-parser.cc: Accept non abbreviated forms of result for select (#2104)YAMAMOTO Takashi2022-12-191-3/+2
| | | | | eg. "select (result i32) (result)" cf. https://github.com/WebAssembly/spec/pull/1567
* Base 64 output is incorrect (#2103)Thomas Tay2022-12-191-1/+3
| | | | | | | | | | | | | | | | | For simple, it decodes to: MCw5NywxMTUsMTA5LDEsMCwwLDAsMSw2LDEsOTYsMSwxMjQsMSwxMjQsMywyLDEsMCw3LDcsMSwzLDEwMiw5Nyw5OSwwLDAsMTAsNDYsMSw0NCwwLDMyLDAsNjgsMCwwLDAsMCwwLDAsMjQwLDYzLDk5LDQsMTI0LDY4LDAsMCwwLDAsMCwwLDI0MCw2Myw1LDMyLDAsMzIsMCw2OCwwLDAsMCwwLDAsMCwyNDAsNjMsMTYxLDE2LDAsMTYyLDExLDExLDAsMTgsNCwxMTAsOTcsMTA5LDEwMSwxLDYsMSwwLDMsMTAyLDk3LDk5LDIsMywxLDAsMA== which is base64 for the literal string: '0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,10,1,6,97,100,100,84,119,111,0,0,10,9,1,7,0,32,0,32,1,106,11,0,10,4,110,97,109,101,2,3,1,0,0' This is the Uint8 array encoded as a string, which is not what we want! We want the numbers as bytes encoded in base64. This answer changes the base64 to: AGFzbQEAAAABBgFgAXwBfAMCAQAHBwEDZmFjAAAKLgEsACAARAAAAAAAAPA/YwR8RAAAAAAAAPA/BSAAIABEAAAAAAAA8D+hEACiCwsAEgRuYW1lAQYBAANmYWMCAwEAAA== Which decodes properly. In Node: ``` > Buffer.from("AGFzbQEAAAABBgFgAXwBfAMCAQAHBwEDZmFjAAAKLgEsACAARAAAAAAAAPA/YwR8RAAAAAAAAPA/BSAAIABEAAAAAAAA8D+hEACiCwsAEgRuYW1lAQYBAANmYWMCAwEAAA==", 'base64') <Buffer 00 61 73 6d 01 00 00 00 01 06 01 60 01 7c 01 7c 03 02 01 00 07 07 01 03 66 61 63 00 00 0a 2e 01 2c 00 20 00 44 00 00 00 00 00 00 f0 3f 63 04 7c 44 00 ... 47 more bytes> ```
* build.yml: check wasm2c running with software memchecks (#2095)Keith Winstein2022-12-021-0/+18
|
* Use inline keyword over WABT_INLINE. NFC (#2092)Sam Clegg2022-12-023-6/+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"
* Remove unused include. NFC (#2094)Sam Clegg2022-12-011-4/+0
|
* Use C++17's [[nodiscard]]. NFC (#2090)Sam Clegg2022-12-022-78/+74
|
* Use C++17's [[maybe_unused]]. NFC (#2089)Sam Clegg2022-12-012-13/+6
|
* fix -Wunused-variable warnings when building without asserts (#2088)walkingeyerobot2022-12-021-4/+4
|
* Reduce code duplication in MemcpyEndianAware definition. NFC (#2087)Sam Clegg2022-12-012-20/+12
|
* update-spec-tests.py: Include wasm2c version of proposals tests (#2085)Sam Clegg2022-12-011-0/+4
|
* Implement Relaxed SIMD proposal (#1994)Marcus Better2022-11-3035-1300/+1770
| | | | | | | | 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.
* Silence gtest and uvwasi warnings on GCC 11 (#2082)Keith Winstein2022-11-301-0/+8
| | | | Required to pass CI on ubuntu-22.04 runners which are phasing in for "ubuntu-latest" workflows on GitHub.
* wasm2c: handle duplicate names across module fields (#2035)Keith Winstein2022-11-303-156/+245
|
* run-spec-wasm2c.py: split `run_spec_tests` function if it's too long (#2077)Keith Winstein2022-11-281-6/+21
| | | | | | This is intended to improve GCC's long compile times for some of the extremely long SIMD tests. On a recent laptop running Ubuntu 22.04 and GCC 11.3, this change reduces the time for the simd_f32x4_pmin_pmax.wast test from 16 minutes to about 70 seconds.
* wasm2c CI: run asan and ubsan tests on clang 14 (#2078)Keith Winstein2022-11-281-2/+4
|
* Include wasm-rt-impl in Windows package (#2072)Remko Tronçon2022-11-161-24/+22
| | | | The wasm2c runtime should now be supported on Windows per 6a89e3f74560eb8f0396c24ce625de0023cb46b2