summaryrefslogtreecommitdiff
path: root/src/tools/wasm-shell.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use const modifier when dealing with types (#3064)Daniel Wirtz2020-08-201-1/+1
| | | Since they make the code clearer and more self-documenting.
* Replace Type::expand() with an iterator-based approach (#3061)Daniel Wirtz2020-08-191-1/+1
| | | This leads to simpler code and is a prerequisite for #3012, which makes it so that not all `Type`s are backed by vectors that `expand` could return.
* Add interpreter support for EH (#2780)Heejin Ahn2020-05-061-0/+3
| | | | | | | | | This adds interpreter support for EH instructions. This adds `ExceptionPackage` struct, which contains info of a thrown exception (an event tag and thrown values), and the union in `Literal` can take a `unique_ptr` to `ExceptionPackage`. We need a destructor, a copy constructor, and an assignment operator for `Literal`, because the union in `Literal` now has a member that cannot be trivially copied or deleted.
* Handle multivalue returns in the interpreter (#2684)Thomas Lively2020-03-101-18/+12
| | | | Updates the interpreter to properly flow vectors of values, including at function boundaries. Adds a small spec test for multivalue return.
* Add support for reference types proposal (#2451)Heejin Ahn2019-12-301-2/+2
| | | | | | | | | | | | This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447.
* Remove FunctionType (#2510)Thomas Lively2019-12-111-1/+1
| | | | | | | | | | | | | | | | | Function signatures were previously redundantly stored on Function objects as well as on FunctionType objects. These two signature representations had to always be kept in sync, which was error-prone and needlessly complex. This PR takes advantage of the new ability of Type to represent multiple value types by consolidating function signatures as a pair of Types (params and results) stored on the Function object. Since there are no longer module-global named function types, significant changes had to be made to the printing and emitting of function types, as well as their parsing and manipulation in various passes. The C and JS APIs and their tests also had to be updated to remove named function types.
* Add string parameter to WASM_UNREACHABLE (#2499)Sam Clegg2019-12-051-2/+1
| | | | | This works more like llvm's unreachable handler in that is preserves information even in release builds.
* Convert to using DEBUG macros (#2497)Sam Clegg2019-12-041-4/+2
| | | | | | This means that debugging/tracing can now be enabled and controlled centrally without managing and passing state around the codebase.
* Update spec test suite (#2484)Heejin Ahn2019-11-291-2/+2
| | | | | | | | | | | | | This updates spec test suite to that of the current up-to-date version of https://github.com/WebAssembly/spec repo. - All failing tests are added in `BLACKLIST` in shared.py with reasons. - For tests that already existed and was passing and started failing after the update, we add the new test to the blacklist and preserve the old file by renaming it to 'old_[FILENAME].wast' not to lose test coverage. When the cause of the error is fixed or the unsupported construct gets support so the new test passes, we can delete the corresponding 'old_[FILENAME].wast' file. - Adds support for `spectest.print_[type] style imports.
* Enable all features in wasm-shell assert failure tests (#2254)Heejin Ahn2019-07-251-0/+1
| | | | | | | If we don't enable features in assertion failure tests, new feature tests fail not because they are malformed but because they have unsupported features. It's hard to add tests because existing `assert_invalid` tests were already failing because they have unsupported features.
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-4/+8
| | | Applies the changes in #2065, and temprarily disables the hook since it's too slow to run on a change this large. We should re-enable it in a later commit.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-50/+75
| | | Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
* Move features from passOptions to Module (#2001)Thomas Lively2019-04-121-3/+4
| | | | | This allows us to emit a (potentially modified) target features section and conditionally emit other sections such as the DataCount section based on the presence of features.
* Use target features section in wasm-opt (#1967)Thomas Lively2019-04-031-1/+1
| | | | | | | If the user does not supply features explicitly on the command line, read and use the features in the target features section for validation and passes. If the user does supply features explicitly, error if they are not a superset of the features marked as used in the target features section and the user does not explicitly handle this.
* Validate unique local names, and use validation in wasm2js. Fixes #1885 (#1886)Alon Zakai2019-01-231-2/+2
| | | | | * Also fixes some bugs in wasm2js tests that did not validate. * Rename FeatureOptions => ToolOptions, as they now contain all the basic stuff each tool needs for commandline options (validation yes or no, and which features if so).
* Feature options (#1797)Thomas Lively2018-12-031-5/+5
| | | | Add feature flags and struct interface. Default feature set has all feature enabled.
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-11/+16
| | | | | | | | | | | | | | Fixes #1649 This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import. For convenient iteration, there are a few helpers like ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) { .. use global .. }); as often iteration only cares about imported or defined (non-imported) things.
* Change the Literal class's operator== to be bitwise (#1661)Alon Zakai2018-09-011-2/+2
| | | | | The change means that nan values will be compared bitwise when writing A == B, and so the float rule of a nan is different from itself would not apply. I think this is a safer default. In particular this PR fixes a fuzz bug in the rse pass, which placed Literals in a hash table, and due to nan != nan, an infinite loop... Also, looks like we really want a bitwise comparison pretty much everywhere anyhow, as can be seen in the diff here. Really the single place we need a floaty comparison is in the intepreter where we implement f32.eq etc., and there the code was already using the proper code path anyhow.
* Rename WasmType => Type (#1398)Alon Zakai2018-02-021-1/+1
| | | | * rename WasmType to Type. it's in the wasm:: namespace anyhow, and without Wasm- it fits in better alongside Index, Address, Expression, Module, etc.
* Restrict validation output to just validation errors in the API (#1253)Daniel Wirtz2017-11-011-1/+5
| | | Do not print the entire and possibly very large module when validation fails. Leave printing to tools using the validator, instead of always doing it in the validator where it can't be overridden.
* precompute-propagate pass (#1179)Alon Zakai2017-09-121-2/+2
| | | | | | | Implements #1172: this adds a variant of precompute, "precompute-propagate", which also does constant propagation. Precompute by itself just runs the interpreter on each expression and sees if it is in fact a constant; precompute-propagate also looks at the graph of connections between get and set locals, and propagates those constant values. This helps with cases as noticed in #1168 - while in most cases LLVM will do this already, it's important when inlining, e.g. inlining of the clamping math functions. This new pass is run when inlining, and otherwise only in -O3/-Oz, as it does increase compilation time noticeably if run on everything (and for almost no benefit if LLVM has run). Most of the code here is just refactoring out from the ssa pass the get/set graph computation, so it can now be used by both the ssa pass and precompute-propagate.
* New fuzzer (#1126)Alon Zakai2017-08-111-15/+9
| | | | | | 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.
* Wasm h to cpp (#926)jgravelle-google2017-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Move WasmType function implementations to wasm.cpp * Move Literal methods to wasm.cpp * Reorder wasm.cpp shared constants back to top * Move expression functions to wasm.cpp * Finish moving things to wasm.cpp * Split out Literal into its own .h/.cpp. Also factor out common wasm-type module * Remove unneeded/transitive includes from wasm.h * Add comment to try/check methods * Rename tryX/checkX methods to getXOrNull * Add missing include that should fix appveyor build breakage * More appveyor
* Refactor Import::Kind and Export::Kind into an ExternalKind enum class (#725)Alon Zakai2016-10-031-2/+2
|
* error on putting spectest.print in a tableAlon Zakai2016-09-211-0/+11
|
* validate spectest.print as a functionAlon Zakai2016-09-201-1/+7
|
* global importing fixes: use the right counter for globals and for functionsAlon Zakai2016-09-201-1/+12
|
* support module operations in shell testsAlon Zakai2016-09-171-28/+55
|
* support assert_malformed in shell test runnerAlon Zakai2016-09-161-1/+6
|
* wasm-shell improvements: print out which module is built, add option to skip ↵Alon Zakai2016-09-071-2/+27
| | | | lines
* better printing when assert_invalids failAlon Zakai2016-09-071-1/+7
|
* separate wasm-opt out from wasm-shell: opt optimizes, shell runs wast shell ↵Alon Zakai2016-07-131-45/+0
| | | | tests
* rename binaryen-shell to wasm-shellAlon Zakai2016-07-131-0/+267