summaryrefslogtreecommitdiff
path: root/src/support
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor optimization defaults (#1366)Alon Zakai2018-01-171-24/+0
| | | | | 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 (#1357)Daniel Wirtz2018-01-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Redundant Set Elimination pass (#1344)Alon Zakai2018-01-052-1/+66
| | | | This optimizes #1343. It looks for stores of a value that is already present in the local, which in particular can remove the initial set to 0 of loops starting at zero, since all locals are initialized to that already. This helps in real-world code, but is not super-common since coalescing means we tend to have assigned something else to it anyhow before we need it to be zero, so this mainly helps in small functions (and running this before coalescing would extend live ranges in potentially bad ways).
* SpillPointers pass (#1339)Alon Zakai2017-12-301-0/+103
| | | | | | | | | | | | | This is an experiment to help with Boehm-style GC. It will spill things that could be pointers to the C stack, so that they can be seen by conservative garbage collection. The spills add code size and runtime overhead, but actually less than I thought: 10% slower (smaller than the difference between VMs), 15% gzip size larger. We can do even better with more optimizations for this, like a dead store elimination pass. This PR does the following: * Add the new pass. * Create an abi/ dir, with info about the pointer size and stack manipulation utilities. * Separates out the liveness analysis from CoalesceLocals, so that other passes can use it (like SpillPointers). * Refactor out the SortedVector class from the liveness analysis to a separate file (just seems nicer that way).
* wasm-metadce tool (#1320)Alon Zakai2017-12-062-1/+403
| | | | | | | 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.
* support fixed (non-relocatable) segments in wasm-merge. also a few printing ↵Alon Zakai2017-12-051-2/+5
| | | | fixes for multiple segments, which we never really printed that prettily (#1316)
* Fix wasm-reduce testing out of tree (#1284)Alon Zakai2017-11-211-0/+58
| | | | * fix wasm-reduce when out-of-tree: do not use a hardcoded bin/wasm-opt, instead add a Path namespace with utilities to get the proper path, and use BINARYEN_ROOT which our test setup code ensures
* Thread fixes (#1205)Alon Zakai2017-10-021-1/+8
| | | | | | * don't use multiple threads in torture tests, which are parallel anyhow * if we fail to create a thread, don't use multiple threads
* disambiguate hash usage (#1182)Alon Zakai2017-09-131-1/+1
|
* Const hoisting (#1176)Alon Zakai2017-09-121-0/+5
| | | A pass that hoists repeating constants to a local, and replaces their uses with a get of that local. This can reduce binary size, but can also *increase* gzip size, so it's mostly for experimentation and not used by default.
* wasm-reduce tool (#1139)Alon Zakai2017-09-012-1/+20
| | | 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.
* Get wasm2asm building again (#1107)Thomas Lively2017-08-021-0/+7
| | | | | | | | | | | | | | | | | | * Get wasm2asm building again Updates CMakeLists.txt to have wasm2asm built by default, updates wasm2asm.h to account for recent interface changes, and restores JSPrinter functionality. * Implement splice for array values * Clean up wasm2asm testing * Print semicolons after statements in blocks * Cleanups and semicolons for condition arms * Prettify semicolon emission
* Fix wasm::read_file() to read correctly sized input strings in text mode. ↵juj2017-07-181-0/+6
| | | | (#1088)
* SSA pass (#1049)Alon Zakai2017-06-131-0/+55
| | | | | | | * Add SSA pass which ensures a single assign for each local, except for merged locals where we ensure exactly a single assign from one of the paths leading to that use * Also add InstrumentLocals pass, useful for debugging locals (similar to InstrumentMemory but for locals) * Fix a PickLoadSigns bug with tees not being ignored, which was not noticed until now because we ran it on flatter output by default, but the ssa pass uncovered the bug
* Log callImport fatal error to cerr so it is not buffered. (#1036)Sam Clegg2017-06-121-1/+3
| | | | | | | Use Fatal() rather than stdout or report callImport error Without this the write to stdout can be lost (Since the following line aborts)
* Fix build with gcc 7 (#957)Morris Hafner2017-03-291-0/+1
| | | | 1. Add a missing <functional> include 2. Put the // fallthrough comment after the closing bracket so the compiler does not emit a implicit fallthrough warning.
* New binaryen.js (#922)Alon Zakai2017-03-241-0/+4
| | | 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.
* Fully handle EM_ASM in s2wasm (#910)jgravelle-google2017-02-231-0/+58
| | | | | | | | | | | | * Fully handle EM_ASM in s2wasm * Iterate with size_ts, remember to erase from importsMap as well * Fix dot_s test EM_ASM signatures * Move Name out to its own file, support/name.h * Move removeImportsWithSubstring out of Module class
* optimize linear sums (#904)Alon Zakai2017-02-161-1/+1
|
* Remove unused captures to fix warnings/errors when compiling with Clang (#896)Eric Holk2017-02-031-2/+1
|
* more consistent placement of & and *, on the type (#848)Alon Zakai2016-11-281-15/+15
|
* Wrap description (#839)Loo Rong Jie2016-11-283-5/+32
|
* Fix Windows colors (#833)Loo Rong Jie2016-11-111-3/+2
| | | | * Fix Windows colors and update README.md
* Use steady_clock to measure code execution time (#776)Loo Rong Jie2016-10-171-3/+3
|
* Fix crash when loading archive files, dereferencing iterator .end() is ↵juj2016-10-141-7/+3
| | | | undefined behavior. (#769)
* Fix crash on loading archives, firstRegularData member field was not ↵juj2016-10-131-1/+1
| | | | initialized to null which caused dereferencing a garbage pointer. (#770)
* ensure we create the OptimizeInstructions database on demand, avoiding ↵Alon Zakai2016-09-071-0/+18
| | | | global ctors
* if we don't recognize the platform in colors.h, just do nothing for colorsAlon Zakai2016-09-071-0/+9
|
* Color support for Windows (#693)Loo Rong Jie2016-09-072-8/+34
|
* Replace std::unique<T>(new T()) with make_unique<T>().Logan Chien2016-08-261-3/+4
| | | | | | | | | | | | | | | | This commit modernize the code base by replacing: std::unique_ptr<T>(new T(...)) with: make_unique<T>(...) or: wasm::make_unique<T>(...) This is a step closer to adopt C++14 std::make_unique<T>(...).
* add support for symbol assignments, closes #4422 (#615)Dominic Chen2016-07-111-1/+1
| | | Adds support for aliases to objects, to go along with the existing support for aliases to functions.
* Build fixes/workarounds to support Visual Studio 2013 build, which has ↵juj2016-06-213-3/+4
| | | | trouble with some new C++11 constructs. (#581)
* use WASM_UNUSED in some places to fix compiler warning/error on unused ↵Alon Zakai2016-06-081-0/+2
| | | | variables we only use in asserts (#579)
* refactor a getNumCores methodAlon Zakai2016-06-022-5/+12
|
* add hash utility, and support for hashing and comparing expressionsAlon Zakai2016-05-281-0/+39
|
* tweak learning index pickingAlon Zakai2016-05-171-2/+1
|
* add genetic learnerAlon Zakai2016-05-171-0/+113
|
* add timer classAlon Zakai2016-05-161-0/+55
|
* Fix Visual Studio 2015 warnings about casting from double to int32_t in ↵BSalita2016-05-121-2/+2
| | | | safe_integer.cpp (#480)
* Fix Visual Studio 2015 C++ warning about negating unsigned value by adding ↵BSalita2016-05-111-4/+4
| | | | typename U in bits.h (#471)
* use CMAKE_THREAD_LIBS_INIT as a target link library, which unbreaks breakage ↵Alon Zakai2016-05-071-0/+1
| | | | from #390 (#450)
* Use more static libraries in the CMake build (#451)Derek Schuff2016-05-071-0/+10
| | | | | | | | | | | * Factor passes and emscripten-optimizer into static libs This removes the redundancies from the source sets in the main CMakeLists.txt. * Make passes an object lib * Use static libs with --whole-archive because Travis has old cmake
* make print flags in archive.cpp nicer (#437)Alon Zakai2016-05-051-2/+2
|
* fix archive.cpp on 32-bitAlon Zakai2016-05-051-1/+1
|
* [Linker] Handle archive filesDerek Schuff2016-05-052-0/+344
| | | | | | | | Add a class to parse archive files. Support linking archive files, with archive semantics (i.e. an archive member is linked in if it satisfies an undefined reference). Archive files must be gnu-format archives containing .s files. Add tests for linking semantics.
* Fix signed integer overflow UB (#430)JF Bastien2016-05-031-1/+1
| | | This puts us back where #404 wanted to be: all UB that ubsan knows about now causes an abort. This ins't to say that it's all gone, merely that our tests don't trigger any more UB which ubsan knows how to find :-)
* Fix {i32,i64}.trunc_{s,u}/{f32,f64} in interpreter (#421)Ben Smith2016-05-022-0/+102
| | | | Check the binary representation of the float instead of converting it to a float first.
* Changed type of flags to fix Visual Studio 2015 error (#418)BSalita2016-04-301-1/+1
| | | Changed type of flags (line 26) in read_file() from auto to std::ios_base::openmode to fix Visual Studio 2015 error.
* Add missing algorithm and string headersJF Bastien2016-04-231-0/+2
| | | As in #382.
* Merge pull request #377 from WebAssembly/zero_x_bAlon Zakai2016-04-211-1/+1
|\ | | | | More 0xb work