| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
| |
and we assumed a non-get is a set (caught by valgrind) (#1472)
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a pass that implements "function pointer cast emulation" - allows indirect calls to go through even if the number of arguments or their types is incorrect. That is undefined behavior in C/C++ but in practice somehow works in native archs. It is even relied upon in e.g. Python.
Emscripten already has such emulation for asm.js, which also worked for asm2wasm. This implements something like it in binaryen which also allows the wasm backend to use it. As a result, Python should now be portable using the wasm backend.
The mechanism used for the emulation is to make all indirect calls use a fixed number of arguments, all of type i64, and a return type of also i64. Thunks are then placed in the table which translate the arguments properly for the target, basically by reinterpreting to i64 and back. As a result, receiving an i64 when an i32 is sent will have the upper bits all zero, and the reverse would truncate the upper bits, etc. (Note that this is different than emscripten's existing emulation, which converts (as signed) to a double. That makes sense for JS where double's can contain all numeric values, but in wasm we have i64s. Also, bitwise conversion may be more like what native archs do anyhow. It is enough for Python.)
Also adds validation for a function's type matching the function's actual params and result (surprised we didn't have that before, but we didn't, and there was even a place in the test suite where that was wrong).
Also simplifies the build script by moving two cpp files into the wasm/ subdir, so they can be built once and shared between the various tools.
|
| |
|
|
|
|
|
|
| |
* limit the amount of asm2wasm warnings on arguments added/removed in flexible argument handling (e.g. in Python there can be many thousands of such warnings, flooding the output...)
* also lock, because those warnings can come from multiple threads
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Emit invokeFuncs list as metadata
* Refactor s2wasm to use ModuleWriter
* Fix wasm-emscripten-finalize metadata output for binary output
* Add a flag to emit binary from s2wasm
NOTE: I chose to emit text by default, and binary behind a flag. This
mismatches with asm2wasm (and the expectations of users of a "2wasm"
tool), but doesn't break any existing users of s2wasm. If s2wasm is
deprecated in favor of lld, this will be the least disruptive change,
and we won't have to live with awkward defaults for too long.
* Emit source maps in the binary output of s2wasm
* Only emit binary with an outfile specified
|
|
|
|
| |
the checks (#1461)
|
|
|
|
|
|
|
|
|
|
| |
* replace assert with a proper trap for an invalid offset in table initialization
* fix offset handling in initial table size computation: it is an unsigned value
* handle traps in fuzz-exec when creating instance
* optimization may remove imports - and imported table init may trap, so opts may remove that trap. check for result comparisons in the right order, so we don't get bothered by that
|
| |
|
|
|
|
|
| |
* 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)
|
| |
|
|
|
|
| |
This change eliminates one issue that prevents asm.js validation of the
generated code, see #1443.
|
|
|
|
|
|
| |
* Drop start function in RemoveUnusedModuleElements if empty
* Update tests and dist files
|
| |
|
|
|
| |
`-Werror` and the warnings provided by any specific toolchain/compiler are not standard.
|
|
|
|
|
|
|
|
|
|
| |
* refactor BINARYEN_PASS_DEBUG code for writing byn-* files, make it easy to emit binaries instead of text
* fix up bad argument numbers in asm2wasm. This can be caused by undefined behavior on the LLVM side, which happens to work natively. it's nicer to fix it up like it would be in a native build, and give a warning, instead of failing to compile
* update build-js.sh
* updated builds
|
|
|
|
|
|
|
|
|
|
|
| |
* Emit EM_JS metadata
* Include s2wasm-style em_js support
* Change em_js metadata to be keyed on name
* Add testcase for em_js, don't always emit emJsFuncs metadata
* Better error handling for unexpectedly-formatted __em_js__ functions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add tests for i32.popcnt
* lower i64.popcnt
* add tests for i64.extend_u/i32
* lower i64.extend_s/i32
* fix lowering i64.eqz
* lower i64.eqz more efficiently
* add tests for i32.clz/i32.ctz
* lower i64.clz/i64.ctz
|
|
|
|
|
|
|
|
|
| |
* Extract comma-handling logic into a lambda function
* Start emitting all metadata from binaryen - handle declares and externs
* Add implementedFunctions and exports metadata
* Remove EM_ASM calls from declares
|
|
|
|
|
|
|
|
|
|
| |
http://webassembly.org/docs/text-format/ says:
> The recommended file extension for WebAssembly code in textual format
> is .wat.
> Note: The .wast format understood by some of the listed tools is a
> superset of the .wat format that is intended for writing test scripts.
|
| |
|
|
|
|
| |
same local that it is ok to read that local, as locals may also be written elsewhere (#1423)
|
|
|
|
| |
collisions between say a global import and a function with a name from the name section that happens to match it (#1424)
|
|
|
|
| |
* add tempRet0 helpers when necessary in legalize-js-interface
|
| |
|
|
|
|
|
|
| |
Also refactors mangling to its own file so it can be reused by generators and consumers, i.e., where it is important to know that an import must be named 'switch_' where it otherwise would be 'switch'.
* Update tests and JS dist files
|
|
|
|
|
|
| |
* don't look for asm.js compilation message if almost asm
* fix wasm2asm f32 operations
|
|
|
|
| |
Adds support for (constant i32/f32/f64) global variable initializers, which were previously ignored though get_global/set_global are supported.
|
|
|
| |
Hash results may differ between runs, as they can depend on pointers. In remove-duplicate-functions, that shouldn't matter, except that we only considered the first item in each hash group vs the others (to avoid O(N^2)), which is fine except for hash collisions (collisions mean 2 groups are merged into one, and considering just the first item vs the rest we miss out on the other duplicates in that single group). And hash collisions do occur (rarely) in practice. Instead, consider all comparisons in each hash group, which should be fine unless we have large amounts of hash collisions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* explicitly handle binary float operations in processFunctionBody
We weren't handling them before, but it wasn't obvious. Make the (non-)
handling of them explicit in the code. We'll add handlers for them
shortly.
* add handling for simple binary float operations
min, max, and copysign will require more sophisticated handling.
* add handling for float comparisons
* move float min/max handling to the correct place
It was previously grouped with the i32 ops.
* handle float promotion and demotion
|
|
|
|
|
|
|
|
|
| |
* fix lowering of i64 adds
We're not permitted to reuse the input as temporary variables for the
results. Weird things happen otherwise.
* add support for lowering i64 subtraction
|
|
|
|
|
|
| |
Many places assume that test/blah is valid, but that's only valid if
you're executing scripts from the binaryen source directory. The
binaryen_test option is more general, and enables out-of-tree testing,
so that's what we should be using instead.
|
| |
|
|
|
| |
Plus some tests, to make sure we implemented things correctly.
|
| |
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
| |
* optimize more simple math operations: mul of 0, or of 0, and of 0, mul of 1, mul of a power of 2, urem of a power of 2
* fix asm2wasm callImport parsing: the optimizer may get rid of the added offset to a function table
* update js builds
|
| |
|
| |
|
|
|
|
|
| |
* fix safe heap check for load/store of fewer bytes than the type
|
|
|
|
|
| |
* wasm-reduce tweaks and improvements: better error messages, better validation, better function removal, etc.
|
|
|
|
| |
it's useful to test infinite loops (#1404)
|
| |
|
| |
|
|\
| |
| | |
Travis: Fix failures, update alpine-chroot-install to 0.7.0
|
| |
| |
| |
| |
| |
| | |
Travis finally implemented conditional stages/jobs, yay!
See: https://docs.travis-ci.com/user/conditional-builds-stages-jobs/
|
|/
|
|
|
| |
Ubuntu has apparently deleted qemu-user-static packages for Zesty...
The script uses packages from Artful since 0.7.0.
|
|
|
| |
This adds necessary command line options for addFunction support, and generates required jsCall imports and generates jsCall thunk functions.
|
|
|
|
|
|
|
|
| |
* Dedupe function names when reading a binary
* More robust name deduplication, use .s instead of _s
* Add name-duplicated wasm binaries
|
|
|
|
|
|
|
|
|
|
| |
* Allow wasm2asm to generate "almost asm"
If grow_memory, current_memory or export memory is
used then generate "almost asm" with memory growth
support.
* Log reason for "almost asm" to stderr
|