summaryrefslogtreecommitdiff
path: root/src/shell-interface.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove implicit conversion operators from Type (#2577)Thomas Lively2020-01-081-1/+1
| | | | | | | | | | * Remove implicit conversion operators from Type Now types must be explicitly converted to uint32_t with Type::getID or to ValueType with Type::getVT. This fixes #2572 for switches that use Type::getVT. * getVT => getSingle
* [NFC] Enforce use of `Type::` on type names (#2434)Thomas Lively2020-01-071-11/+11
|
* Add support for reference types proposal (#2451)Heejin Ahn2019-12-301-3/+5
| | | | | | | | | | | | 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-5/+6
| | | | | | | | | | | | | | | | | 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-1/+1
| | | | | This works more like llvm's unreachable handler in that is preserves information even in release builds.
* 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.
* Print only literal values when printing literals (#2469)Heejin Ahn2019-11-261-2/+2
| | | | | | | | | | | | | | | Current `<<` operator on `Literal` prints `[type].const` with it. But `[type].const` is rather an instruction than a literal itself, and printing it with the literals makes less sense when we later have literals whose type don't have `const` instructions (such as reference types). This patch - Makes `<<` operator on `Literal` print only its value - Makes wasm-shell's shell interface comply with the spec interpreter's printing format (`value : type`). - Prints wasm-shell's `[trap]` message to stderr These make all `fix_` routines for spec tests in check.py unnecessary.
* Add initial support for anyref as an opaque type (#2294)Jay Phelps2019-08-201-0/+2
| | | | | | | | | | | | | Another round of trying to push upstream things from my fork. This PR only adds support for anyref itself as an opaque type. It does NOT implement the full [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)--so no table.get/set/grow/etc or ref.null, ref.func, etc. Figured it was easier to review and merge as we go, especially if I did something fundamentally wrong. *** I did put it under the `--enable-reference-types` flag as I imagine that even though this PR doesn't complete the full feature set, it probably is the right home. Lmk if not. I'll also be adding a few github comments to places I want to point out/question.
* Rename except_ref type to exnref (#2224)Heejin Ahn2019-07-141-2/+2
| | | | In WebAssembly/exception-handling#79 we agreed to rename `except_ref` type to `exnref`.
* Add except_ref type (#2081)Heejin Ahn2019-05-071-0/+2
| | | | This adds except_ref type, which is a part of the exception handling proposal.
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-3/+6
| | | 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-29/+49
| | | 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-23/+4
| | | | | | | | | | 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.
* Passive segments (#1976)Thomas Lively2019-04-051-0/+3
| | | | | Adds support for the bulk memory proposal's passive segments. Uses a new (data passive ...) s-expression syntax to mark sections as passive.
* Code style improvements (#1868)Alon Zakai2019-01-151-1/+1
| | | | * Use modern T p = v; notation to initialize class fields * Use modern X() = default; notation for empty class constructors
* Compare binaryen fuzz-exec to JS VMs (#1856)Alon Zakai2019-01-101-1/+1
| | | | | | | | | | | The main fuzz_opt.py script compares JS VMs, and separately runs binaryen's fuzz-exec that compares the binaryen interpreter to itself (before and after opts). This PR lets us directly compare binaryen's interpreter output to JS VMs. This found a bunch of minor things we can do better on both sides, giving more fuzz coverage. To enable this, a bunch of tiny fixes were needed: * Add --fuzz-exec-before which is like --fuzz-exec but just runs the code before opts are run, instead of before and after. * Normalize double printing (so JS and C++ print comparable things). This includes negative zero in JS, which we never printed properly til now. * Various improvements to how we print fuzz-exec logging - remove unuseful things, and normalize the others across JS and C++. * Properly legalize the wasm when --emit-js-wrapper (i.e., we will run the code from JS), and use that in the JS wrapper code.
* SIMD (#1820)Thomas Lively2018-12-131-0/+6
| | | | | | | | | Implement and test the following functionality for SIMD. - Parsing and printing - Assembling and disassembling - Interpretation - C API - JS API
* Add virtual destructor to fix build warning/error (#1793)Sam Clegg2018-11-301-0/+1
| | | | | | | | This error started showing up after: #1779 error: delete called on non-final 'wasm::ShellExternalInterface' that has virtual functions but non-virtual destructor
* Fuzzing: log values during execution (#1779)Alon Zakai2018-11-301-1/+1
| | | | | | | | Before we just looked at function return values when looking for differences before and after running some passes, while fuzzing. This adds logging of values during execution, which can represent control flow, monitor locals, etc., giving a lot more opportunities for the fuzzer to find problems. Also: * Clean up the sigToFunctionType function, which allocated a struct and returned it. This makes it safer by returning the struct by value, which is also easier to use in this PR. * Fix printing of imported function calls without a function type - turns out we always generate function types in loading, so we didn't notice this was broken, but this new fuzzer feature hit it.
* Add v128 type (#1777)Thomas Lively2018-11-291-0/+1
|
* standardize on 'template<' over 'template <' (i.e., remove a space) (#1782)Alon Zakai2018-11-291-3/+3
|
* Remove default cases (#1757)Thomas Lively2018-11-271-1/+2
| | | | | | Where reasonable from a readability perspective, remove default cases in switches over types and instructions. This makes future feature additions easier by making the compiler complain about each location where new types and instructions are not yet handled.
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-9/+15
| | | | | | | | | | | | | | 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.
* Print Stack IR in proper .wat format (#1630)Alon Zakai2018-08-141-1/+1
| | | This now makes --generate-stack-ir --print-stack-ir emit a fully valid .wat wasm file, in stacky format.
* afl-fuzz fixes for table/memory instantiation (#1460)Alon Zakai2018-03-061-4/+8
| | | | | | | | | | * replace assert with a proper trap for an invalid offset in table initialization * fix offset handling in initial table size computation: it is an unsigned value * handle traps in fuzz-exec when creating instance * optimization may remove imports - and imported table init may trap, so opts may remove that trap. check for result comparisons in the right order, so we don't get bothered by that
* 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.
* Make several derived classes final (#1180)Derek Schuff2017-09-121-1/+1
| | | | | | | Recent versions of clang turn on -Wdelete-non-virtual-dtor at our warning level, which fires when deleting a non-final class that has virtual functions but a non-virtual destructor. Pre-C++11 standard rule of thumb is to just always have a virtual destructor if there are virtual functions, but C++11 final is even better since it may allow for devirtualization optimizations.
* Log callImport fatal error to cerr so it is not buffered. (#1036)Sam Clegg2017-06-121-2/+2
| | | | | | | Use Fatal() rather than stdout or report callImport error Without this the write to stdout can be lost (Since the following line aborts)
* trap on bad result types in shell-interface callTableAlon Zakai (kripken)2017-06-011-0/+3
|
* ctor evaller (#982)Alon Zakai2017-04-281-57/+16
| | | | | 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).
* 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
* Fully handle EM_ASM in s2wasm (#910)jgravelle-google2017-02-231-0/+1
| | | | | | | | | | | | * 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
* 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/+4
|
* table parsing and executing fixesAlon Zakai2016-09-201-1/+2
|
* support spectest.globalAlon Zakai2016-09-201-1/+14
|
* use globals in asm2wasmAlon Zakai2016-09-071-3/+5
|
* call_indirect is now structural, so no need to pass the type name aroundAlon Zakai2016-09-071-2/+1
|
* add drop and tee expressionsAlon Zakai2016-09-071-1/+1
|
* offset support in tableAlon Zakai2016-08-151-0/+24
|
* support expressions in segment offsetsAlon Zakai2016-08-121-2/+3
|
* add shared-constants.h for wasm constantsAlon Zakai2016-06-261-0/+1
|
* refactor interpreter code to provide expression executors for both ↵Alon Zakai2016-06-181-1/+1
| | | | standalone and full funtime execution
* parse error detailsAlon Zakai2016-05-121-1/+0
|
* use exceptions consistently to report input errorsAlon Zakai2016-05-121-0/+5
|
* Introduce a separate type for linear memory addresses (#477)Derek Schuff2016-05-111-3/+3
| | | | | | | We've been using size_t (and other things) for addresses, which is generally wrong because it depends on the host, when it should in fact depend on the target. This is a partial fix for #278 (i.e. it's the right fix, I don't think it's applied quite everywhere yet).
* just use a simple vector in data segmentsAlon Zakai2016-04-271-3/+3
|
* Split construction, scanning, and building phases of S2WasmBuilder (#400)Derek Schuff2016-04-271-2/+1
| | | | | | | | | | | Instead of doing all of the S2Wasm work in the constructor, split construction, scanning (to determine implemented functions) and building of the wasm module. This allows the linker to get the symbol information (e.g. implemented functions) without having to build an entire module (which will be useful for archives) and to allow the linker to link a new object into the existing one by building the wasm module in place on the existing module.
* refactor shell interface into its own fileAlon Zakai2016-04-041-0/+180