summaryrefslogtreecommitdiff
path: root/src/tools/wasm-ctor-eval.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add a builder.makeConst helper template (#2971)Alon Zakai2020-07-211-1/+1
|
* Add interpreter support for EH (#2780)Heejin Ahn2020-05-061-0/+6
| | | | | | | | | 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.
* Tuple globals (#2718)Thomas Lively2020-04-021-10/+10
| | | | | | | Since it wasn't easy to support tuples in Asyncify's call support using temporary functions, we decided to allow tuple-typed globals after all. This PR adds support for parsing, printing, lowering, and interpreting tuple globals and also adds validation ensuring that imported and exported globals do not have tuple types.
* Update Precompute to handle tuples (#2687)Thomas Lively2020-03-101-2/+2
| | | | | | This involves replacing `Literal::makeZero` with `Literal::makeZeroes` and `Literal::makeSingleZero` and updating `isConstantExpression` to handle constant tuples as well. Also makes `Literals` its own struct and adds convenience methods on it.
* Handle multivalue returns in the interpreter (#2684)Thomas Lively2020-03-101-6/+6
| | | | Updates the interpreter to properly flow vectors of values, including at function boundaries. Adds a small spec test for multivalue return.
* Trap when call_indirect's signatures mismatch (#2636)Heejin Ahn2020-02-031-0/+5
| | | | | | | | | | | This makes the interpreter trap when the signature in `call_indirect` instruction and that of the actual function in the table mismatch. This also makes the `wasm-ctor-eval` not evaluate `call_indirect` in case the signatures mismatch. Before we only compared the arguments' signature and the function signature, which was sufficient before we had subtypes, but now the signature in `call_indirect` and that of the actual function can be different even if the argument's signature is OK.
* Add string parameter to WASM_UNREACHABLE (#2499)Sam Clegg2019-12-051-1/+2
| | | | | 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-7/+1
| | | | | | This means that debugging/tracing can now be enabled and controlled centrally without managing and passing state around the codebase.
* Reflect instruction renaming in code (#2128)Heejin Ahn2019-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Reflected new renamed instruction names in code and tests: - `get_local` -> `local.get` - `set_local` -> `local.set` - `tee_local` -> `local.tee` - `get_global` -> `global.get` - `set_global` -> `global.set` - `current_memory` -> `memory.size` - `grow_memory` -> `memory.grow` - Removed APIs related to old instruction names in Binaryen.js and added APIs with new names if they are missing. - Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent name clashes. - Resolved several TODO renaming items in wasm-binary.h: - `TableSwitch` -> `BrTable` - `I32ConvertI64` -> `I32WrapI64` - `I64STruncI32` -> `I64SExtendI32` - `I64UTruncI32` -> `I64UExtendI32` - `F32ConvertF64` -> `F32DemoteI64` - `F64ConvertF32` -> `F64PromoteF32` - Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to `BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for consistency.
* Allow color API to enable and disable colors (#2111)Siddharth2019-05-171-1/+1
| | | | | | This is useful for front-ends which wish to selectively enable or disable coloring. Also expose these APIs from the C API.
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-2/+4
| | | 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-88/+119
| | | 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
* Refactor interpreter initialization to use bulk memory (#2025)Thomas Lively2019-04-181-8/+7
| | | | | | | | | | This corresponds to changes made to the initialization procedure in the spec. It also removes all the heavy initialization work from the external interface of the interpreter, which is a nice encapsulation win. Implementation of the interpretation of the remaining bulk memory operations and more rigorous tests of that interpretation will come in a follow-up PR.
* Move features from passOptions to Module (#2001)Thomas Lively2019-04-121-2/+1
| | | | | 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.
* Move segment merging to fit web limits into its own pass (#1980)Thomas Lively2019-04-081-2/+5
| | | | | | It was previously part of writing a binary, but changing the number of segments at such a late stage would not work in the presence of bulk memory's datacount section. Also updates the memory packing pass to respect the web's limits on the number of data segments.
* Passive segments (#1976)Thomas Lively2019-04-051-4/+6
| | | | | Adds support for the bulk memory proposal's passive segments. Uses a new (data passive ...) s-expression syntax to mark sections as passive.
* Massive renaming (#1855)Thomas Lively2019-01-071-1/+1
| | | | | | Automated renaming according to https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329.
* SIMD (#1820)Thomas Lively2018-12-131-2/+2
| | | | | | | | | Implement and test the following functionality for SIMD. - Parsing and printing - Assembling and disassembling - Interpretation - C API - JS API
* wasm-ctor-eval: handle the stack going either up or downAlon Zakai2018-12-111-10/+15
|
* constant refactoring for STACKTOP and STACK_MAXAlon Zakai2018-12-111-8/+8
|
* standardize on 'template<' over 'template <' (i.e., remove a space) (#1782)Alon Zakai2018-11-291-3/+3
|
* wasm-ctor-eval: Hard error if requested ctor does not exist (#1728)Sam Clegg2018-11-061-1/+5
| | | | | Not being able to evaluate a ctor is different to that ctor being absent. This is masked a bug in emscripten where we were spelling the names of the ctors wrong on the command line.
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-18/+19
| | | | | | | | | | | | | | 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.
* Misc tiny fuzz fixes (#1668)Alon Zakai2018-09-121-0/+6
| | | | | | | | | | | | * show a proper error for an empty asm2wasm input * handle end of input in processExpressions in binary reading * memory segment sizes should be unsigned * validate input in wasm-ctor-eval * update tests
* wasm-ctor-eval improvements (#1631)Alon Zakai2018-08-071-0/+4
| | | | | * When we eval a ctor, don't just nop the function body that no longer needs to be executed, also remove the export (as we report the ctor being evalled, and the outside will no longer call it). * Run the pass to remove unused global things. This can usually remove evalled ctors (unless something else happens to call them, which can't happen normally as LLVM wouldn't use a ctor in another place, but e.g. duplicate function merging might merge a ctor with another function).
* 'std::string &' => 'std::string& ' (#1403)Alon Zakai2018-02-051-2/+2
| | | The & on the type is the proper convention.
* 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.
* notation change: AST => IR (#1245)Alon Zakai2017-10-241-4/+4
| | | The IR is indeed a tree, but not an "abstract syntax tree" since there is no language for which it is the syntax (except in the most trivial and meaningless sense).
* Remove unused PassOptions from wasm-ctor-eval.cpp (#1238)Taiju Tsuiki2017-10-241-1/+0
| | | |passOptions| in wasm-ctor-eval.cpp causes a compile failure, -Wunused-variable on the clang build.
* clean up ImportUtils: make getImport return the import (more consistent with ↵Alon Zakai2017-10-171-22/+38
| | | | other similar APIs) and fix some ctor-evalling handling of imports, which was incorrect - we need to create fake globals when importing globals, not later, which is too late for initialized globals from imports (#1226)
* some readme and doc fixes and improvements (#1219)Alon Zakai2017-10-101-1/+1
|
* Fix wrong name in --help output (#1099)Alan Mimms2017-07-171-1/+1
|
* ctor-eval fixes (#996)Alon Zakai2017-05-051-3/+19
| | | | | | | | * 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
* ctor evaller (#982)Alon Zakai2017-04-281-0/+409
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).