summaryrefslogtreecommitdiff
path: root/wasm2c
Commit message (Collapse)AuthorAgeFilesLines
* wasm2c: Segue optimization for modules with a single unshared memory (#2395)Shravan Narayan2024-06-2611-13/+1426
|
* Correct wasm2c example Makefiles (#2426)David Rubin2024-06-035-9/+14
| | | | | | | | - Passing "-lm" into the prereq isn't the correct way add the flag. This correctly adds it to the command. - The "rot13" example incorrectly assumed that the "rot13.h" file would be generated by the time that "main.c" was being compiled, however there is no rule supporting this and it would fail. I've also added "rot13.h" to the clean rule.
* wasm2c: Fix warning on signed/unsigned comparisonShravan Narayan2024-03-201-1/+1
|
* wasm2c: Cleanup examples makefileShravan Narayan2024-02-123-6/+3
|
* wasm2c/README.md: update to reflect new compile command post-#2308 (#2390)Keith Winstein2024-02-121-2/+2
|
* Fallback to pthreads if threads aren't available (#2385)walkingeyerobot2024-02-061-7/+7
|
* Do not use guard pages on big-endian (#2382)Soni L2024-02-021-2/+4
|
* Add missing casts on big-endian (#2381)Soni L2024-02-011-2/+2
|
* wasm2c: move table ops to an include fileShravan Narayan2024-01-312-37/+87
|
* wasm2c: Cleanup formatting of wasm-rt.hShravan Narayan2024-01-301-58/+63
|
* wasm2c: atomic and shared mem operations using c11Shravan Narayan2024-01-305-179/+453
|
* Fix emscripten build warning and add missing export (#2367)Changqing Jing2024-01-191-0/+2
|
* wasm2c: Add macro and tests to allow disabling stack exhaustion checksShravan Narayan2024-01-021-2/+22
|
* Update wasm2c examples (#2358)Keith Winstein2023-12-152-56/+49
|
* wasm2c: Cleanup/separate code for heap and stack signal handlersShravan Narayan2023-12-144-67/+92
|
* wasm2c runtime: fix mis-nesting of def'n of os_has_altstack_installed (#2346)Keith Winstein2023-12-052-15/+20
| | | | | Also adds an RLBox-like CI test where the embedder takes responsibility for signal handling Co-authored-by: wrv <wrv@utexas.edu>
* wasm2c runtime: clean up some error messages (NFC) (#2345)Keith Winstein2023-12-031-7/+3
|
* w2c runtime: add per-thread init/free API (#2332)Keith Winstein2023-12-047-6/+170
|
* wasm2c runtime: refactor handling of alternate stack (NFC) (#2338)Keith Winstein2023-11-281-12/+81
| | | | | The runtime installs an alternate stack to handle SIGSEGV from stack exhaustion. Make this variable thread-local and refactor implementation that touches it.
* wasm2c: define null values of funcref and externref (#2330)Willy R. Vasquez2023-11-161-2/+2
| | | | wasm_rt_funcref_null_value and wasm_rt_externref_null_value are changed to preprocessor macros for C and C++ compatibility
* wasm2c: implement the tail-call proposal (#2272)Keith Winstein2023-10-244-7/+45
|
* [wasm2c] Use wasm_rt_memcpy everywhere in generated code (#2292)Sam Clegg2023-09-091-15/+15
|
* Share reading/validation code between elem exprs & other const exprs (#2288)Keith Winstein2023-09-061-5/+18
| | | | | | This continues the work from #1783 and reduces special handling of elem exprs, by treating them the same as other const expressions (init expressions).
* wasm2c: add link to clang bug on mips force read constraintShravan Narayan2023-07-301-0/+1
|
* wasm2c: ensure force read constraints compile for clang on mipsShravan Narayan2023-07-301-20/+28
|
* wasm2c: add cpp guard in wasm2c exceptions headerShravan Narayan2023-06-221-0/+8
|
* wasm2c: partial support for atomic memory opsShravan Narayan2023-05-172-1/+4
|
* wasm2c: include simd128.h and wasm-rt-exceptions.h where necessary (#2236)Keith Winstein2023-05-122-136/+1
| | | Co-authored-by: Shravan Narayan <shravanrn@gmail.com>
* wasm2c: Enable exceptions and simd according to command line flagsShravan Narayan2023-05-0211-132/+180
|
* wasm2c: reduce the max exceptions sizeShravan Narayan2023-05-011-1/+1
|
* wasm-rt-impl: reset g_signal_handler_installed in wasm_rt_free (#2209)Keith Winstein2023-04-211-0/+1
|
* wasm2c: Misc docs and inline comment fixesShravan Narayan2023-04-132-17/+11
|
* wasm2c: Add optional WASM_RT_GROW_FAILED_HANDLER to be notified of memory ↵Shravan Narayan2023-04-122-2/+22
| | | | growth failures
* wasm2c: Separate the macros for allocation and bounds checks strategiesShravan Narayan2023-04-124-53/+138
|
* wasm2c: add signature for the wasm2c trap handler if definedShravan Narayan2023-04-102-4/+8
|
* wasm2c: multiple .c outputs (#2146)Yuhan Deng2023-04-051-21/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * wasm2c: multiple .c outputs This enables wasm2c to have multiple .c outputs, which allows parallel compilation of the wasm2c outputs. This is useful when the input WASM module is big. wasm2c takes the number of .c outputs as an argument to `--num-outputs` (defaulting to 1). If the number is equal to 1, the .c output does not change except for two new macro declarations and the ordering of declarations and definitions. If greater than 1, wasm2c outputs change in the following ways: 1) wasm2c outputs a [module-name]-impl.h that includes any module-wide declarations, including: * content of `WriteSourceTop()` * function type declarations * tag types * tag declarations * function declarations * data segments and elem segments declarations Any static declaration become extern in this header. 2) wasm2c outputs [module-name]_i.c for i = [0, ..., number of .c outputs - 1). Any module-wide material is written to [module-name]_0.c, including: * function types, tags, data segments, elem segments * imports and exports * module initialization, instantiation and free 3) For each function implementation, wasm2c assigns it to one output .c file by sorting the function names and partitioning into roughly equal buckets. Alternately, the caller can supply its own assignment function (helpful if it wants the assignments to be more stable in the face of function insertion or deletion).
* Fix grammatical error (#2179)David Park2023-03-241-1/+1
|
* c-writer.cc: Add local symbol prefix. (#2171)Yuhan Deng2023-03-152-30/+30
| | | | | | Add kLocalSymbolPrefix which is used for names of params, locals and stack vars. This allows c-writer to not assign global_sym_map_ to local_sym_map_ for writing each individual function, since local names can't duplicate global names.
* wasm2c: prettify/change name mangling (#2142)Keith Winstein2023-02-237-137/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* wasm2c: add SIMD support (#2119)Willy R. Vasquez2023-01-294-0/+133
| | | 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.
* Make wasm2c output UBSAN-clean (and run w2c CI w/ UBSAN) (#2080)Keith Winstein2023-01-281-2/+8
| | | | | | 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.
* wasm2c: serialize types at wasm2c-time (#2120)Keith Winstein2023-01-2511-162/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* wasm-rt.h: Use thread-local storage for traps/exceptions on MSVCKeith Winstein2023-01-161-1/+3
|
* wasm2c: Initial implementation of memory64 (#2086)Sam Clegg2023-01-122-17/+29
| | | | | | | 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-113-18/+12
| | | | This lets exception tags be pre-assigned, instead of making the runtime keep an incrementing counter.
* wasm2c: harden set/longjmp to check for uninit jmp_bufShravan Narayan2023-01-033-12/+32
|
* Update wasm2c fac.c example (#2067)Keith Winstein2022-11-151-4/+2
|
* Update testsuite (#2054)Sam Clegg2022-11-131-24/+25
| | | | | | | | | | | | | | | 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