summaryrefslogtreecommitdiff
path: root/src/parsing.h
Commit message (Collapse)AuthorAgeFilesLines
* Prepare for compound types that are single but not basic (#3046)Daniel Wirtz2020-08-171-6/+6
| | | | | | | | | | | | | | As a follow-up to https://github.com/WebAssembly/binaryen/pull/3012#pullrequestreview-459686171 this PR prepares for the new compound Signature, Struct and Array types that are single but not basic. This includes: * Renames `Type::getSingle` to `Type::getBasic` (NFC). Previously, its name was not representing its implementation (`isSingle` excluded `none` and `unreachable` while `getSingle` didn't, i.e. `getSingle` really was `getBasic`). Note that a hypothetical `Type::getSingle` cannot return `ValueType` anyway (new compound types are single but don't map to `ValueType`), so I figured it's best to skip implementing it until we actually need it. * Marks locations where we are (still) assuming that all single types are basic types, as suggested in https://github.com/WebAssembly/binaryen/pull/3012#discussion_r465356708, but using a macro, so we get useful errors once we start implementing the new types and can quickly traverse the affected locations. The macro is added where * there used to be a `switch (type.getSingle())` or similar that handled any basic type (NFC), but in the future will also have to handle single types that are not basic types. * we are not dealing with `Unary`, `Binary`, `Load`, `Store` or `AtomicXY` instructions, since these don't deal with compound types anyway.
* Rename anyref to externref to match proposal change (#2900)Jay Phelps2020-06-101-1/+1
| | | | | | | anyref future semantics were changed to only represent opaque host values, and thus renamed to externref. [Chromium](https://bugs.chromium.org/p/v8/issues/detail?id=7748#c360) was just updated to today (not yet released). I couldn't find a Mozilla bugzilla ticket mentioning externref so I don't immediately know if they've updated yet. https://github.com/WebAssembly/reference-types/pull/87
* Add br_on_exn support for UniqueNameMapper (#2659)Heejin Ahn2020-02-191-0/+3
| | | | This adds support for UniqueNameMapper, and adds a test in Inlining pass, which uses UniqueNameMapper.
* Remove implicit conversion operators from Type (#2577)Thomas Lively2020-01-081-6/+6
| | | | | | | | | | * 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-21/+21
|
* Add support for reference types proposal (#2451)Heejin Ahn2019-12-301-2/+4
| | | | | | | | | | | | 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.
* 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.
* Multivalue type creation and inspection (#2459)Thomas Lively2019-11-221-1/+1
| | | | | | | | | | | | | Adds the ability to create multivalue types from vectors of concrete value types. All types are transparently interned, so their representation is still a single uint32_t. Types can be extracted into vectors of their component parts, and all the single value types expand into vectors containing themselves. Multivalue types are not yet used in the IR, but their creation and inspection functionality is exposed and tested in the C and JS APIs. Also makes common type predicates methods of Type and improves the ergonomics of type printing.
* Add initial support for anyref as an opaque type (#2294)Jay Phelps2019-08-201-0/+1
| | | | | | | | | | | | | 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-1/+1
| | | | In WebAssembly/exception-handling#79 we agreed to rename `except_ref` type to `exnref`.
* Add except_ref type (#2081)Heejin Ahn2019-05-071-0/+1
| | | | This adds except_ref type, which is a part of the exception handling proposal.
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-18/+36
| | | 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-52/+97
| | | 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
* Add const specifiers (#1952)Ryoga2019-03-181-2/+2
| | | | | | With this we can write stuff like: const wasm::Expression* p; const wasm::Binary* q = p->cast<wasm::Binary>();
* Add v128 type (#1777)Thomas Lively2018-11-291-0/+1
|
* Remove default cases (#1757)Thomas Lively2018-11-271-1/+4
| | | | | | 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.
* Notice parse errors on number parsing in the text format (#1608)Loppin Vincent2018-07-241-0/+6
| | | | | | | * - Throw ParseException when istringstream failed to read a number. - Modify now invalid tests. * Add invalid_number.wast test
* Some simple integer math opts (#1504)Alon Zakai2018-04-111-1/+1
| | | | | | | | | Stuff like x + 5 != 2 => x != -3. Also some cleanups of utility functions I noticed while writing this, isTypeFloat => isFloatType. Inspired by https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/gen/generic.rules
* Rename WasmType => Type (#1398)Alon Zakai2018-02-021-2/+2
| | | | * rename WasmType to Type. it's in the wasm:: namespace anyhow, and without Wasm- it fits in better alongside Index, Address, Expression, Module, etc.
* handle empty stack in sourceToUniqueAlon Zakai (kripken)2017-06-011-1/+4
|
* throw parse errors in UniqueNameMapperAlon Zakai (kripken)2017-06-011-2/+8
|
* harden parsing.hAlon Zakai (kripken)2017-06-011-46/+50
|
* Exporting/importing debug location information from .wast/.asm.js/.s formats ↵Yury Delendik2017-06-011-0/+19
| | | | | | | | (#1017) * Extends wasm-as, wasm-dis and s2wasm to consume debug locations. * Exports source map from asm2wasm
* Wasm h to cpp (#926)jgravelle-google2017-03-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* Require unique names in binaryen IR (#746)Alon Zakai2016-10-061-0/+85
|
* parsing fix in compiled-to-js parser (#669)Alon Zakai2016-08-121-4/+4
|
* fix parsing of large intsAlon Zakai2016-07-061-2/+2
|
* add shared-constants.h for wasm constantsAlon Zakai2016-06-261-2/+3
|
* parse error detailsAlon Zakai2016-05-121-0/+27
|
* Split construction, scanning, and building phases of S2WasmBuilder (#400)Derek Schuff2016-04-271-2/+2
| | | | | | | | | | | 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.
* Fix the build with GCC 5.3.1 and Clang 3.8.0.Csaba Osztrogonác2016-03-311-2/+2
| | | | Fixes #299
* parse nans with all due careAlon Zakai2016-02-021-2/+2
|
* save int bits in Literals, only bitcast to float/double on explicit requestAlon Zakai2016-02-021-21/+18
|
* don't accept -+ #163Alon Zakai2016-02-021-1/+5
|
* Use bit_cast in parseConst, avoid UBJF Bastien2016-01-281-24/+19
|
* Fix / uniformize include guardsJF Bastien2015-12-221-0/+5
|
* Fix the license headersJF Bastien2015-12-211-1/+15
| | | | This applies Apache 2.0 properly (as far as our lawyers have told me). We can do this early since all of the code was written by Alon Zakai.
* process on s2wasm, and first working testcaseAlon Zakai2015-12-101-0/+2
|
* refactor const parsingAlon Zakai2015-12-101-0/+151