summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Code folding (#1076)Alon Zakai2017-06-2811-24885/+27472
| | | | | | | | | | | | | | | | Adds a pass that folds code, i.e. merges it when possible. See details in comment in the pass implementation cpp. This is enabled by default in -Os and -Oz. Seems risky to enable anywhere else, as it does add branches - likely predictable ones so maybe no slowdown, but still some risk. Code size numbers: wasm-backend: 196331 + binaryen -Os (before): 182598 + binaryen -Os (with folding): 181943 asm2wasm -Os (before): 172463 asm2wasm -Os (with folding): 168774 So this reduces wasm-backend output by an additional 0.5% than it could before. Mainly this is because the wasm backend already has code folding, whereas on asm2wasm output, where we didn't have folding before, this saves over 2%. The 0.5% improvement on the wasm backend's output might be because this can fold more types of code than LLVM can (it can fold nested control flow, in particular).
* Add atomic loads and stores (#1077)Derek Schuff2017-06-284-0/+290
| | | | | Add IR, wast and binary support for atomic loads and stores. Currently all IR generated by means other than parsing wast and binary files always generates non-atomic accesses, and optimizations have not yet been made aware of atomics, so they are certainly not ready to be used yet.
* Runtime.stackAlloc should grow down for wasm (#1073)jgravelle-google2017-06-2884-504/+252
| | | | | | * Runtime.stackAlloc should grow down for wasm * stackAlloc should align properly; update tests
* Add shared memories (#1069)Derek Schuff2017-06-2713-0/+38
| | | | | 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.
* Fix auto_update_tests for printing/minifier tests (#1071)Derek Schuff2017-06-273-1/+118
| | | | | 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.
* Consistently handle possible traps in all cases (#1062)Alon Zakai2017-06-228-44/+224
| | | | | | * consistently handle possible traps in asm.js ffi results * consistently handle possible traps in i64/float conversions
* Revert "Update known failures running s2wasm results in wasm-shell (#1057)" ↵Sam Clegg2017-06-221-3/+12
| | | | | (#1063) This reverts commit 722e6a1893b7d662e536da206835821b2096c0ee.
* Update known failures running s2wasm results in wasm-shell (#1057)Sam Clegg2017-06-201-12/+3
| | | | | The two new failures are calling aboirt(). They date back to before the LKGR build: https://wasm-stat.us/builders/linux/builds/20068 So its hard to say when they started failing.
* Untee pass (#1053)Alon Zakai2017-06-142-0/+60
|
* S-expression parsing in C API and binaryen.js (#1050)Alon Zakai2017-06-133-7/+50
| | | | | | * add C API and binaryen.js support for parsing s-expressions * update js builds and tests
* SSA pass (#1049)Alon Zakai2017-06-136-0/+1188
| | | | | | | * 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
* Support new result syntax for if/loop/block (#1047)Sam Clegg2017-06-12127-1817/+1817
| | | | | | Support both syntax formats in input since the old spec tests still need to be parsable.
* Optimize/merge duplicate function types (#1041)Alon Zakai2017-06-1216-52/+90
|
* update testsSam Clegg2017-06-091-4/+4
|
* C API fixes (#1042)Alon Zakai2017-06-071-12/+12
| | | | | | * fix mutex usage in C API, and some minor cleanup around it too * update testcase that was forgotten to be updated before
* Update binaryen-c/binaryen.js, fixes #1028, fixes #1029 (#1030)Daniel Wirtz2017-06-076-76/+88
| | | This PR adds global variable support (addGlobal, getGlobal, setGlobal), host operations (currentMemory, growMemory), a few utility functions (removeImport, removeExport, getFunctionTypeBySignature with the latter being scheduled for removal once a better alternative is in place) and it introduces an additional argument to specify the result type in BinaryenBlock (effectively breaking the C-API but retaining previous behaviour by introducing the BinaryenUndefined() type for this purpose). Additionally, it enables compilation with exception support in build-js.sh as exceptions are thrown and caught when optimizing endless loops, intentionally resulting in an unreachable opcode. Affected test cases have been updated accordingly.
* S2wasm runtime funcs (#1027)jgravelle-google2017-06-0584-0/+3024
| | | | | | | | | | | | | | | | * Generate stackSave function in s2wasm * Generate stackAlloc in s2wasm * Generate stackRestore in s2wasm * Update dot_s tests for runtime functions * Add s2wasm check for exporting runtime functions * Fix flake8 for s2wasm.py * Rename wasmBuilder to builder
* validate returned values in all cases, even if the function returns none we ↵Alon Zakai2017-06-025-6/+8
| | | | should still not have returns with a value, etc. update spec tests to remove some stacky tests that do not fit these new validation rules (#1034)
* Exporting/importing debug location information from .wast/.asm.js/.s formats ↵Yury Delendik2017-06-0116-84/+317
| | | | | | | | (#1017) * Extends wasm-as, wasm-dis and s2wasm to consume debug locations. * Exports source map from asm2wasm
* simplify reloop testcaseAlon Zakai2017-05-242-5/+12
|
* relooper improvementsAlon Zakai (kripken)2017-05-203-4/+67
|
* use TypeUpdater in vacuumAlon Zakai (kripken)2017-05-2013-7554/+7418
|
* afl-fuzz bug fixes (#1018)Alon Zakai2017-05-204-0/+290
| | | | | | | | * values cannot flow through an if without an else, they never return a value * check pass tests in pass-debug mode too * add missing finalization in binary reading
* Validate finalization (#1014)Alon Zakai2017-05-1831-212/+3438
| | | | | | | * validate that types are properly finalized, when in pass-debug mode (BINARYEN_PASS_DEBUG env var): check after each pass is run that the type of each node is equal to the proper type (when finalizing it, i.e., fully recomputing the type). * fix many fuzz bugs found by that. * in particular, fix dce bugs with type changes not being fully updated during code removal. add a new TypeUpdater helper class that lets a pass update types efficiently, by the helper tracking deps between blocks and branches etc., and updating/propagating type changes only as necessary.
* optimize if and select in the case their values are identical (#1013)Alon Zakai2017-05-176-67/+151
|
* Re-reloop pass (#1009)Alon Zakai2017-05-164-0/+1299
| | | | | This adds a pass that converts to a CFG, runs the relooper, and re-generates wasm from that. This depends on flatten-control-flow being run before. The main goal here is to help code generators other than asm2wasm (which already receives relooped code from fastcomp).
* merge blocks before and after remove-unused-brsAlon Zakai (kripken)2017-05-105-61/+62
|
* allow values to flow out of loops in RemoveUnneededBrs, and simplify some ↵Alon Zakai (kripken)2017-05-109-1126/+1101
| | | | unnecessary complexity in that pass as well
* Flatten control flow pass (#999)Alon Zakai2017-05-102-0/+1953
| | | | | | | | | | | This pass flattens out control flow in order to achieve 2 properties: * Control flow structures (block, loop, if) and control flow operations (br, br_if, br_table, return, unreachable) may only be block children, a loop body, or an if-true or if-false. (I.e., they cannot be nested inside an i32.add, a drop, a call, an if-condition, etc.) * Disallow block, loop, and if return values, i.e., do not use control flow to pass around values. As a result, expressions cannot contain control flow, and overall control flow is simpler, more structured, and more "flat". This should make things like re-relooping wasm code much easier, as they can run after the cfg is flattened
* asm2wasm: properly infer return type of a call inside a sequence (#1006)Alon Zakai2017-05-097-12/+126
|
* fix autoDrop, now that we properly set block types, unreachable can easily ↵Alon Zakai2017-05-097-0/+183
| | | | happen, and autoDrop wasn't handling it (#1005)
* Unreachable typing fixes (#1004)Alon Zakai2017-05-097-30/+295
| | | | | | | | | | | | * 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
* fix an afl-fuzz bug where precompute alters a br to remove its condition, ↵Alon Zakai2017-05-082-0/+31
| | | | but does not properly modify the type (#1000)
* ctor-eval fixes (#996)Alon Zakai2017-05-0517-31/+97
| | | | | | | | * fix wasm-ctor-eval, we need to look for the STACKTOP etc. imports, they may not be named, if this build is not with -g * pack memory after ctor evalling, since we merge it up which is less efficient * do some useful opts after ctor-evalling, to clean things up
* fix unreachable typing: for all nodes, if they are not reached - e.g., a ↵Alon Zakai (kripken)2017-05-021-9/+11
| | | | binary with either side unreachable - then they are unreachable. this makes our usage of the unreachable type consistent
* when creating blocks during dce, make sure they have the same type as before ↵Alon Zakai (kripken)2017-05-022-4/+65
| | | | the transformation, as the outside might care about that
* disallow empty blocks with a type - if they return a type, they must have ↵Alon Zakai2017-05-021-0/+4
| | | | contents. make s2wasm avoid outputting that as well (#992)
* improve dce to handle more cases of nested unreachable code (#989)Alon Zakai2017-05-026-72/+172
| | | | | | | | | | * improve dce to handle more cases of nested unreachable code, in particular, when the child is unreachable in type but not an actual Unreachable node, e.g. if it's a br. in that case, we just need to verify that the br is not to us where we are a block or loop * handle unreachable switch conditions in dce * handle dce of br condition which is unreachable, and host arguments * handle dce of block i32 etc. which is actually unreachable
* Validation fixes for issues noticed by afl (#988)Alon Zakai2017-05-029-0/+9
| | | | | | | | | | | | * properly validate block endings * blocks with a value must not have a last element that is none * fully validate input types to binary expressions * validate i32.eqz/i64.eqz more carefully * if condition must be i32
* --no-js-ffi opt to disable JS FFI mangling. (#984)Joel Martin2017-05-0114-0/+370
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* handle a drop of an if with both arms unreachable, which is possible since ↵Alon Zakai2017-05-012-0/+36
| | | | wasm added if types, which mean the if can be i32 even if the arms are unreachable etc (#991)
* Add pass to instrument loads / stores. (#959)Michael Bebenita2017-04-292-0/+511
| | | | | | | | * Add pass to instrument loads / stores * Simplify instrumentation. * Document.
* ctor evaller (#982)Alon Zakai2017-04-2842-0/+616
| | | | | 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).
* Preserve debug info through the optimizer (#981)Alon Zakai2017-04-287-33/+1093
| | | | | | | | | | | | | | * add debugInfo option to passes, and use it to keep debug info alive through optimizations when we need it * add fib testcase for debug info * when preserving debug info, do not move code around call-imports, so debug info intrinsics remain stationary * improve wasm-module-building handling of the single-threaded case: don't create workers, which is more efficient and also nicer for debugging * process debug info in a more precise way, reordering it from being after the node (as it was a comment in JS) to before the node * remove unreachable hack for debug info, which is no longer needed since we reorder them, and make sure to finalize blocks in which we reorder
* update wasm.js and binaryen.js (#977)Alon Zakai2017-04-191-1/+1
| | | | | | * update wasm.js and binaryen.js * update test output for new names section
* handle unsigned float-to-int properly in asm2wasmAlon Zakai (kripken)2017-04-184-4/+9
|
* add test for f64-to-int signed/unsignedAlon Zakai (kripken)2017-04-187-0/+128
|
* Fix bustage (#975)Alon Zakai2017-04-186-108/+148
| | | | | | * support -g in wasm-opt, which makes it easier to upgrade binaries for bustage * upgrade binaries in test/merge to new names section format
* wasm-merge tool (#919)Alon Zakai2017-04-1780-0/+1641
| | | | 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.
* Extensible name section (#933)pipcet2017-04-131-1/+1
| | | | | | | | | | | | | See https://github.com/WebAssembly/binaryen/issues/914. * extensible name section support: read function names, too * c-api-unused-mem.txt: change expected size to match new name section * * check subsection size matches * print warning for unknown name subsections (including the local section)