| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
This makes `wasm_rt_init()` properly reentrant. By setting `g_alt_stack
= NULL`, we allow execution to continue beyond [wasm-rt-impl.c L171
](https://github.com/WebAssembly/wabt/blob/main/wasm2c/wasm-rt-impl.c#L171)
in `os_allocate_and_install_altstack`.
Applies to debug builds only due to `assert`.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Also adds an RLBox-like CI test where the embedder takes responsibility for signal handling
Co-authored-by: wrv <wrv@utexas.edu>
|
| |
|
| |
|
|
|
|
|
| |
The runtime installs an alternate stack to handle SIGSEGV
from stack exhaustion. Make this variable thread-local
and refactor implementation that touches it.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
growth failures
|
| |
|
| |
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
(#2047)
|
| |
|
|
|
|
| |
In production use cases, unwinding the stack before reporting an error throws away valuable information such as the stack trace. This hook allows the host to implement an alternate error recovery/reporting mechanism
|
| |
|
|
|
|
|
|
|
|
| |
Correct handling of Wasm's 8gb model on Windows
- Uses the Windows ExceptionHandler to track access violations (segfaults)
- Fix Windows memory to reserve, but not commit memory up front
- Correct handling of return values in os_mmap functions
- Decouple stack depth handling and heap bounds checking
|
| |
|
|
|
|
| |
Restores current versions of all non-SIMD tests in the core testsuite
and multi-memory and exception-handling proposals.
|
|
|
| |
Co-authored-by: Angela Montemayor <amontema@cs.stanford.edu>
|
|
|
| |
This matches how they are declared in the header file.
|
|
|
|
|
| |
(The imports.txt and exports.txt tests require multi-table and
are disabled until reference types is supported.)
|
|
|
|
|
| |
And use the `wasm_rt_` prefix for the one non-static global.
While reviewing #1930 I noticed these globals could/should be static.
|
|
|
|
|
|
|
|
|
| |
Enable optimization when compiling the wasm2c output on non-Windows platforms (effectively GCC and clang). This required:
- Preventing load instructions from being optimized away if their value is unused (using inline assembly with an input operand and empty code). This is necessary to force an OOB trap on platforms that use mprotect and the signal handler to detect OOB.
- Disabling tail-call optimization in the compiler, to make sure that infinite recursion traps. (This required bumping the version of macOS in GitHub Actions to get a new-enough AppleClang. We should revert this back to 'macos-latest' as soon as that becomes the default.)
- Using NaN-quieting versions of a bunch of FP ops that were previously only used on Windows, and adding floor/ceil and promotion/demotion.
- Using the '-frounding-math' and '-fsignaling-nans' compiler flags to tell GCC and clang not to fold certain FP ops (e.g. subtracting zero, multiplying by 1).
Fixes #1925.
|
|
|
|
|
|
| |
This will be required by module instancing and bulk memory
ops to avoid a memory leak detected by asan.
Update README.md to reflect changes, including the `fac` walkthrough.
|
|
|
|
|
|
| |
On MacOS, merge OOB and exhaustion traps. (Linux distinguishes these as SEGV_ACCERR vs. SEGV_MAPERR in the
si_code, but MacOS seems to deliver a SEGV_ACCERR for both.)
Add wasm_rt_init() and wasm_rt_free() functions to wasm-rt.h that the embedder must call to set up and clean up the runtime state. (If the embedder doesn't call these, OOB and exhaustion will result in an uncaught segfault.)
|
|
|
|
|
|
|
| |
All tests are now passing with cl.exe under x64. With x86 there are some test failure that I believe relate
the use of the x87 registers to pass floating point numbers. I suggest we look into fixing those as a followup.
Split out from #1833
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial attempt at s390x port
* Second attempt at s390x port
* Fix big-endian memory fill
* Fix more memory location calculations
* Improve SIMD
* Implement big-endian memory grow
* Fill relocation with 0x00, as per spec
* Make wasm2c endianness work
* Fix shuffle
* Fix load endianness in wasm2c
* Refactor into shared code
* Clean up SwapBytesSized
* Clean up MemcpyEndianAware
* Clean up
* "Fix" opcodecnt basic test
|
|
|
| |
We really should enable Werror on CI..
|
| |
|
|
|
|
|
|
|
| |
* Test whether this works for macOS
* Use __builtin_memcpy (fixes bug on macOS)
* Use #if instead of #ifdef (so 0 and 1 values work properly)
* Add `WASM_RT_SETJMP` and `WASM_RT_LONGJMP` macros
|
|
|
| |
See issue #1159.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Addresses:
gcc -I/tmp/wabt/wasm2c -O3 /tmp/wabt/wasm2c/wasm-rt-impl.c -o wasm-rt-impl.o
/tmp/wabt/wasm2c/wasm-rt-impl.c: In function ‘wasm_rt_grow_memory’:
/tmp/wabt/wasm2c/wasm-rt-impl.c:111:3: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
memset(memory->data + old_pages * PAGE_SIZE, 0, delta * PAGE_SIZE);
^~~~~~
/tmp/wabt/wasm2c/wasm-rt-impl.c:111:3: warning: incompatible implicit declaration of built-in function ‘memset’
/tmp/wabt/wasm2c/wasm-rt-impl.c:111:3: note: include ‘<string.h>’ or provide a declaration of ‘memset’
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
with gcc (Debian 6.3.0-18+deb9u1).
|
|
|
|
| |
Also fix bug when parsing elem/data segment; the table/memory index is
stored as an LEB128, not a U8.
|