| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
(#2149)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
| |
Fixes #1631
|
|
|
|
| |
names from getting stripped (#2143)
|
|
|
| |
Fixes #2139
|
|
|
|
| |
Fixes #2136
|
|
|
| |
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.
|
|
|
| |
Will shorten the critical path after wasm2c is running SIMD tests
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
This allows overriding flags like -O2 by appending -O0 from the env var.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
(#2133)
|
|
|
|
| |
I mistakenly broke the wasm2c test runner in #2086. I guess we need
tests for our test runner..
|
| |
|
| |
|
|
|
|
|
|
|
| |
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`.
|
| |
|
|
|
|
| |
This lets exception tags be pre-assigned, instead of
making the runtime keep an incrementing counter.
|
|
|
|
| |
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 *).
|
| |
|
|
|
|
| |
The instruction was removed from the Relaxed SIMD spec, so this
implementation is now up to date.
|
|
|
|
| |
Prevent clang-format from automatically changing manually formatted regions of code
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
| |
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
|
|
|
|
|
| |
eg. "select (result i32) (result)"
cf. https://github.com/WebAssembly/spec/pull/1567
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
```
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Required to pass CI on ubuntu-22.04 runners which are
phasing in for "ubuntu-latest" workflows on GitHub.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
The wasm2c runtime should now be supported on Windows per
6a89e3f74560eb8f0396c24ce625de0023cb46b2
|