| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
| |
If locals are known to contain the same value, we can
* Pick which local to use for a get_local of any of them. Makes sense to prefer the most common, to increase the chance of one dropping to zero uses.
* Remove copies between a local and one that we know contains the same value.
This is a consistent win, small though, around 0.1-0.2%.
|
|
|
|
|
|
| |
* Add a helper class to iterate over all a node's children, and use that when attempting to replace a node with its children.
* If a child has a different type than the parent, try to replace the parent with a conversion + the child (for example, a call may receive two f32 inputs and return an i32; we can try to replace the call with one of those f32s and a conversion to an i32).
* When possible, try to replace the function body with a child even if the child has a different type, by changing the function return value.
|
| |
|
|
|
|
|
|
|
| |
The documentation for the simplify-locals pass suggests running
reorder-locals after it to clean up unnecessary locals. wasm2asm wasn't
doing this, which meant that generated code had a number of unused
variables. A good minimizer will probably clean that up, but let's go
ahead and clean it up in wasm2asm itself.
|
|
|
|
|
| |
We were using the global to return 64-bit values from functions, but
said global wasn't actually present in the IR. This omission caused the
generated code to fail validation.
|
|
|
|
|
|
|
|
|
| |
We were using Math_{min,max} in wasm2asm-generated files without
declaring said functions. This decision created problems for tests,
because Math_min (resp. max) would first be used on f32s, thus returning
f32, and then validation would fail when it was used on f64s.
The resulting changes make wasm2asm tests pass with MOZJS asm.js
validation, which moves #1443 forward.
|
|
|
|
| |
This change eliminates one issue that prevents asm.js validation of the
generated code, see #1443.
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
| |
* Initial source map support for C/JS
* Also test getDebugInfoFileName
|
|
|
|
|
|
| |
fixes #1369
* Update binaries and kitchen-sink test
|
|
|
|
|
| |
Followup to #1357. This moves the optimization settings into pass.h, and uses it from there in the various places.
This also splits up huge lines from the tracing code, which put all block children (whose number can be arbitrarily large) on one line. This seems to have caused random errors on the bots, I suspect from overflowing a buffer. Anyhow, it's much more clear to split the lines at a reasonable length.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
| |
We can remove the memory/table (itself, or an import if imported) if they are not used. This is pretty minor on a large wasm file, but when reading small wasts it's very noticeable to have an unused memory and table all the time.
|
|
|
|
|
|
|
| |
* add get_global/set_global validation
* validate get_local index
* update builds
* fix tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
| |
* binaryen.js improvements: block default value is none, not undefined, and add text-format style aliases for things like getLocal (so you can write get_local as in the text format)
|
|
|
|
| |
* Provide AddImport/AddExport for each element in the C-API
|
|
|
| |
* Also other function utilities in C and JS APIs
|
| |
|
|
|
|
|
| |
* flatten tee_local in flatten, as it leads to more-optimizable code (tee_local, when nested, can introduce side effects in bad places).
* also fix some test stuff from recent merges
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
* fix wasm2asm in binaryen.js, the function locals may not all have names, so add them as necessary
|
| |
|
|
|
| |
Adds --safe-heap which instruments the code to check heap loads and stores for validity (null pointer derefs, within range of valid sbrk memory, and alignment). Used in SAFE_HEAP in emscripten.
|
|
|
|
| |
* Added BinaryenModulePrintAsmjs (using wasm2asm) + Module#emitAsmjs JS binding
|
|
|
|
|
|
| |
* add docs and error hints when a Call should be a CallImport
* fix binaryen API docs in docs/
|
|
|
|
|
|
| |
* add C API and binaryen.js support for parsing s-expressions
* update js builds and tests
|
|
|
|
|
|
| |
Support both syntax formats in input since the old spec
tests still need to be parsable.
|
|
|
|
|
|
| |
* fix mutex usage in C API, and some minor cleanup around it too
* update testcase that was forgotten to be updated before
|
|
|
|
|
|
| |
* update wasm.js and binaryen.js
* update test output for new names section
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Adds command-line argument to build-js.sh for specifying the location of Emscripten. Also spreads out program arguments on separate lines
* Exposes WasmBinaryWriter and BufferWithRandomAccess in the JS API to allow writing WASM modules and access the produced bytes via the JS API
* Updates bin/binaryen.js and bin/wasm.js from changes to build-js.sh
* Adds exclude patterns to .gitignore for some files generated by build-js.sh and .DS_Store for macOS
* Changes build-js.sh to use EMSCRIPTEN env var instead of a command-line argument to provide the path to emscripten
* Improvements to JS builds
- Adds -g flag to build-js.sh that will build unoptimized and unmangled versions of binaryen.js and wasm.js (output has a "-g.js" suffix to allow co-existence with regular optimized builds).
- Enables closure compiler for non-debug builds
- Adds browser test for s-expression parser + WASM code gen (requires wasm to be enabled in the browser.)
- Adds iterator interface to BufferWithRandomAccess (when Symbol.iterator is available)
- Adds toArrayBuffer to BufferWithRandomAccess (when TypedArray is available)
- Adds compileWast(sourceText :string) :ArrayBuffer to the module, parsing & compiling s-expression code to a WASM module
- Changes the way binaryen.js is exported to allow usage in CommonJS, AMD and UMD envionments.
* Expose "Binaryen" global in a better way to work with a.js generated by check.py
* Fix to binaryen.js to only export a global variable when running the test (a.js) while inside a module (avoids polluting global in e.g. nodejs). Also fixes a spelling mistake.
* Better "no WASM detected" message in test/binaryen.js/browser.html
* Small change to error message in build-js.sh where $EMSCRIPTEN does not point to a directory
* Changes emcc args in build-js.sh after investingating a large number of argument combinations. Also adds a browser benchmark. The result of emcc arguments and the effect on performance is summarized in this doc: https://gist.github.com/rsms/e33c61a25a31c08260161a087be03169
* Enable inferring emscripten path by looking in PATH when EMSCRIPTEN is not set in env
|
|
|
|
|
|
| |
* Use Module instead of AllocatingModule in binaryen.js tests
* include compiled binaryen.js, too
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|