| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
Remove executable bit and #! from scripts that don't have
entry point.
Add missing licence test.
Move arg parsing into a function.
Remove legacy --only_prepare (with underscrore) argument.
|
|
|
|
| |
Also refactor auto_update_tests.py into functions to match
check.py
|
|
|
|
|
| |
* Move wasm2asm test outputs into their natural location, test/wasm2asm/
* Let people create new tests in there that ./auto_update_tests.py will auto-generate outputs for, just like all the other tests.
|
| |
|
|
|
|
| |
After #1450, it looks like `auto_update_tests.py` was not changed to
account for the new, updated expectations filename.
|
|
|
|
|
| |
* allow tests in test/passes/ to have a numeric name, in which case there is a name.passes file with the names instead of the name containing the passes (which might be long, see #1020)
|
|
|
|
|
|
|
| |
* wasm-link-metadata: Use `__data_end` symbol.
* Add --global-base param to emscripten-wasm-finalize to compute staticBump properly
* Let ModuleWriter write to a provided Output object
|
| |
|
|
|
| |
This adds necessary command line options for addFunction support, and generates required jsCall imports and generates jsCall thunk functions.
|
|
|
|
|
|
|
|
| |
Refactor ThreadPool code for clarity and to fix some bugs with using the pool from different threads in parallel.
We have a singleton pool, and need to ensure it is created only once and used only by one thread at a time. This model is a simple way to ensure we use a number of threads equal to the number of cores, more or less (a pool per Module might lead to number of cores * number of Modules being optimized).
This refactoring adds a parent pointer in the worker threads (giving them direct access to the pool makes it simpler to make sure that pool and thread creation and teardown are threadsafe). This commit also adds proper locking around pool creation and pool usage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Skeleton of a beginning of o2wasm, WIP and probably not going to be used
* Get building post-cherry-pick
* ast->ir, remove commented out code, include a debug module print because linking
* Read linking section, print emscripten metadata json
* WasmBinaryWriter emits user sections on Module
* Remove debugging prints, everything that isn't needed to build metadata
* Rename o2wasm to lld-metadata
* lld-metadata support for outputting to file
* Use tables index instead of function index for initializer functions
* Add lld-emscripten tool to add emscripten-runtime functions to wasm modules (built with lld)
* Handle EM_ASM in lld-emscripten
* Add a list of functions to forcibly export (for initializer functions)
* Disable incorrect initializer function reading
* Add error printing when parsing .o files in lld-metadata
* Remove ';; METADATA: ' prefix from lld-metadata, output is now standalone json
* Support em_asm consts that aren't at the start of a segment
* Initial test framework for lld-metadata tool
* Add em_asm test
* Add support for WASM_INIT_FUNCS in the linking section
* Remove reloc section parsing because it's unused
* lld-emscripten can read and write text
* Add test harness for lld-emscripten
* Export all functions for now
* Add missing lld test output
* Add support for reading object files differently
Only difference so far is in importing mutable globals being an object
file representation for symbols, but invalid wasm.
* Update help strings
* Update linking tests for stackAlloc fix
* Rename lld-emscripten,lld-metadata to wasm-emscripten-finalize,wasm-link-metadata
* Add help text to header comments
* auto& instead of auto &
* Extract LinkType to abi/wasm-object.h
* Remove special handling for wasm object file reading, allow mutable globals
* Add braces around default switch case
* Fix flake8 errors
* Handle generating dyncall thunks for imports as well
* Use explicit bool for stackPointerGlobal
* Use glob patterns for lld file iteration
* Use __wasm_call_ctors for all initializer functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add optimize, shrink level and debug info options to C/JS
* Add instantiate functionality for creating additional unique instances of the API
* Use a workaround when running tests in node
Tests misuse a module as a script by concatenating, so instead of catching this case in the library, catch it there
* Update sieve test
Seems optimized output changed due to running with optimize levels 2/1 now
* Use the options with all pass runners
* Update relooper-fuzz C-API test
* Share defaults between tools and the C-API
* Add a test for optimize levels
* Unify node test support in check.by and auto_update_tests.py
* Also add getters for optimize levels and test them
* Also test debugInfo
* Add debug info to C tests that used it as well
* Fix missing NODEJS import in auto_update_tests
* Detect node.js version (WASM support)
* Update hello-world JS test (now also runs with node)
* feature-test WebAssembly in node instead
* Document that these options apply globally, and where
* Make sure hello-world.js output doesn't differ between mozjs/node
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* binaryen.js and wasm.js don't need filesystem support
* newest emscripten no longer uses Runtime.*
* build fixes for binaryen.js and wasm.js also move binaryen.js to use standard emscripten MODULARIZE
* run binaryen.js in all possible engines ; update js builds
* don't emit debug build to a different name, just emit binaryen.js. makes testing easier and safer
* remove volatile things from binaryen.js info printing in tests
|
|
|
|
|
|
|
| |
This adds a new tool for better dead code elimination. The problem this helps overcome is when the wasm module is part of something larger, like a wasm+JS combination, and therefore doing DCE in either one is not sufficient as it can't remove a cycle spanning the wasm and JS worlds. Concretely, when binaryen performs DCE by itself, it can never remove an export, because it considers those roots - but in the larger ("meta") space outside, they may actually be removable.
To solve that, this tool receives a description of the outside graph (in very abstract form), including which nodes are roots. It then adds to that graph nodes from the wasm, so that we have a single graph representing the entire space (the outside + wasm + connections between them). It then performs DCE, finding what is not reachable from the roots, and cleaning it up from the wasm. It of course can't clean up things from the outside, since all it has is the abstract representation of those things in the graph, but it prints out the ids of the removable nodes, which an outside tool can use.
This tool is written in as general a way as possible, hopefully it can have multiple uses. The use I have in mind is to write something in emscripten that uses this to DCE the JS+wasm combination that we emit.
|
|
|
|
| |
* fix wasm2asm in binaryen.js, the function locals may not all have names, so add them as necessary
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rename flatten-control-flow to flatten, which now flattens everything, not just control flow, so e.g.
(i32.add
(call $x)
(call $y)
)
==>
(block
(set_local $temp_x (call $x))
(set_local $temp_y (call $y))
(i32.add
(get_local $x)
(get_local $y)
)
)
This uses more locals than before, but is much simpler and avoids a bunch of corner cases and fuzz bugs the old one hit. We can optimize later if necessary.
|
|
|
|
|
|
|
|
|
|
| |
* Add --trap-mode=allow/clamp/js argument to asm2wasm and s2wasm
* Update asm2wasm and auto_update_tests scripts to use --trap-mode
* Throw std::invalid_argument instead of adding a new Invalid TrapMode type
* Remove legacy asm2wasm trap mode arguments
|
|
|
|
| |
Following WebAssembly/threads#58
e.g. (memory $0 23 256 shared) is now (memory $0 (shared 23 256))
|
|
|
|
|
|
|
|
| |
* if a block has a concrete final element (or a break with a value), then even if it has an unreachable child, keep it with that concrete type. this means we no longe allow the silly case of a block with an unreachable in the middle and a concrete as the final element while the block is unreachable - after this change, the block would have the type of the final element
* if an if has a concrete element in one arm, make it have that type as a result, even if the if condition is unreachable, to parallel block
* make type rules for brs and switches simpler, ignore whether they are reachable or not. whether they are dead code should not affect how they influence other types in our IR.
|
|
|
| |
Reduce an interesting wasm to a smaller still interesting wasm. This takes an arbitrary command to run, and reduces the wasm as much as it can while keeping the behavior of that command fixed. This can be used to reduce compiler bugs in an arbitrary VM, etc.
|
|
|
|
|
| |
Also, fix -l and -rpath lib directories so that it can be
run out-of-tree
|
|
|
|
|
|
| |
This adds a new method of fuzzing, "translate to fuzz" which means we consider the input to be a stream of data that we translate into a valid wasm module. It's sort of like a random seed for a process that creates a random wasm module. By using the input that way, we can explore the space of valid wasm modules quickly, and it makes afl-fuzz integration easy.
Also adds a "fuzz binary" option which is similar to "fuzz execution". It makes wasm-opt not only execute the code before and after opts, but also write to binary and read from it, helping to fuzz the binary format.
|
|
|
|
| |
a negative value to a positive one, as trapping is tricky
|
|
|
|
|
| |
Begin to implement wasm threading proposal in https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md
This PR just has shared memory attribute with wast and binary support.
|
|
|
|
|
| |
It was using wasm-shell instead of wasm-opt to print. This was
emitting an error and empty output. Also this means that the min.wast
test input didn't get updated along with the spec, so I fixed that as well.
|
| |
|
|
|
|
|
|
|
|
| |
(#1017)
* Extends wasm-as, wasm-dis and s2wasm to consume debug locations.
* Exports source map from asm2wasm
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix type of drop, set_local, set_global, load, etc: when operand is unreachable, so is the node itself
* support binary tests properly in test/passes
* fix unreachable typing of blocks with no name and an unreachable child
* fix continue emitting in asm2wasm
* properly handle emitting of unreachable load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Always use scripts.test.shared for bin paths.
Update scripts/test/shared.py to add WASM_MERGE relative to build
directory. Update auto_update_tests.py to use scripts.test.shared
variables for all bin paths. Update check.py to use
scripts.test.shared for wasm-merge path (this was missing).
This allows check.py and auto_update_tests.py to be run from the
source directory using built binaries in a different location.
* --no-legalize-javascript-ffi disables JS FFI mangling.
For JS/Web platform, calls to JS imports are wrapped to convert i64 to
i32 and f32 to f64. Likewise calls from JS into exports do the inverse
wrapping. This change provides an option to disable that wrapping and
use the original types for the call.
Includes tests test/noffi_f32.asm.js and test/noffi_i64.asm.js to make
sure neither f32->f64 nor i64->i32 type mangling is happening when
--no-legalize-javascript-ffi is specified.
To fully disable JS FFI mangling when using emscripten, the fastcomp
FFI mangling must also be disabled using the
-emscripten-legalize-javascript-ffi=0 flag.
|
|
|
|
|
| |
Add wasm-ctor-eval, which evaluates functions at compile time - typically static constructor functions - and applies their effects into memory, saving work at startup. If we encounter something we can't evaluate at compile time in our interpreter, stop there.
This is similar to ctor_evaller.py in emscripten (which was for asm.js).
|
|
|
|
| |
wasm-merge tool: combines two wasm files into a larger one, handling collisions, and aware of the dynamic linking conventions. it does not do full static linking, but may eventually.
|
|
|
| |
New binaryen.js implementation, based on the C API underneath and with a JS-friendly API on top. See docs under docs/ for API details.
|
|
|
| |
* use 3 modes for potentially trapping ops in asm2wasm: allow (just emit a potentially trapping op), js (do exactly what js does, even if it takes a slow ffi to do it), and clamp (avoid the trap by clamping as necessary)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* an unreachable block is one with an unreachable child, plus no breaks
* document new difference between binaryen IR and wasm
* fix relooper missing finalize
* add a bunch of tests
* don't assume that test/*.wast files print to themselves exactly; print to from.wast. this allows wast tests with comments in them
* emit unreachable blocks as (block .. unreachable) unreachable
* if without else and unreachable ifTrue is still not unreachable, it should be none
* update wasm.js
* cleanups
* empty blocks have none type
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parse file/line comments in asm.js into debug intrinsics
* convert debug intrinsics into annotations, and print them
* ignore --debuginfo if not emitting text, as wasm binaries don't support that yet
* emit full debug info when -g and emitting text; when -g and emitting binary, all we can do is the Names section
* update wasm.js
|
|
|
|
|
|
|
|
| |
* add --ignore-implicit-traps option, and by default do not ignore them, to properly preserve semantics
* implicit traps can be reordered, but are side effects and should not be removed
* add testing for --ignore-implicit-traps
|
|
|
|
|
| |
* Added ModuleReader/Writer classes that support text and binary I/O
* Use them in wasm-opt and asm2wasm
|
|
|
|
| |
* handle stacky code in binaries, using a block+local
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Refactor check.py so that groups of tests can be split into separate files
- Move helper util functions into test/shared.py
- Move scripts/support.py to test/support.py
- Split s2wasm tests into its own file
* Fix flake8 warnings for shared.py and s2wasm.py
* Move test scripts from test/ to scripts/test/
* Replace 'from shared import *' with explicit imports
|
|
|
|
| |
depending on an import
|
| |
|
|
|
|
| |
And use them in wasm-opt and asm2wasm consistently and uniformly.
|
|
|
|
|
|
| |
* wasm-only loads and stores
* wasm-only 32-bit bitcasts
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support i64 intrinsics from fastcomp, adding --wasm-only flag
* refactor callImport logic in asm2wasm to avoid recomputing wasm types again
* legalize illegal i64 params in exports and imports
* do safe i64 binary ops depending on precision
* fix addVar, only assert on names if we are using a name
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Several updates for s2wasm and its tests:
Add explicit drops where they are emitted by LLVM already
Convert loops (which are still modeled in the old way by LLVM) to wrap them in an explicit block (for the exit label). This also allows simplifying the loop creation (no need to post-process the implicit block which is the loop's body). After the engines update to 0xc we should update LLVM to model loops in the 0xc way, but for now it remains compatible with 0xb and 0xc.
Fix the order of the calls to setTee() when creating tee_locals
Add an explicit drop when creating the _start entry function wrapper if needed
Update dot_s and llvm_autogenerated tests to remove store-results optimization (and few other minor updates)
Fix the test auto-updater to fail if subprocesses fail
There still seems to be a validation failure when building libc (I think it's from the stricter drop rules, but it may be in the source rather than the compiler), but this at least makes Binaryen's tests pa
|
|
|
|
|
|
|
|
| |
apply memory segments only if there isn't a memory initializer (which we need for asmjs and asm2wasm modes)
use wasm-opt to check recreated wasts for validity, as wasm-shell would try to execute them
add testing for combined modes like asmjs,interpret-binary
|
| |
|
| |
|