summaryrefslogtreecommitdiff
path: root/src/emscripten-optimizer/parser.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove obsolete parser code (#6607)Thomas Lively2024-05-291-984/+0
| | | | | Remove `SExpressionParser`, `SExpressionWasmBuilder`, and `cashew::Parser`. Simplify gen-s-parser.py. Remove the --new-wat-parser and --deprecated-wat-parser flags.
* Switch from `typedef` to `using` in C++ code. NFC (#5258)Sam Clegg2022-11-151-1/+1
| | | | This is more modern and (IMHO) easier to read than that old C typedef syntax.
* Make `Name` a pointer, length pair (#5122)Thomas Lively2022-10-111-7/+42
| | | | | | | | | | | | | | | | | | | | | | | With the goal of supporting null characters (i.e. zero bytes) in strings. Rewrite the underlying interned `IString` to store a `std::string_view` rather than a `const char*`, reduce the number of map lookups necessary to intern a string, and present a more immutable interface. Most importantly, replace the `c_str()` method that returned a `const char*` with a `toString()` method that returns a `std::string`. This new method can correctly handle strings containing null characters. A `const char*` can still be had by calling `data()` on the `std::string_view`, although this usage should be discouraged. This change is NFC in spirit, although not in practice. It does not intend to support any particular new functionality, but it is probably now possible to use strings containing null characters in at least some cases. At least one parser bug is also incidentally fixed. Follow-on PRs will explicitly support and test strings containing nulls for particular use cases. The C API still uses `const char*` to represent strings. As strings containing nulls become better supported by the rest of Binaryen, this will no longer be sufficient. Updating the C and JS APIs to use pointer, length pairs is left as future work.
* [wasm2js] Support exports of Globals (#4523)magic-akari2022-03-171-2/+4
| | | | | | Export an object with a `.value` property like the wasm JS API does in browsers, and implement them with a getter and setter. Fixes #4522
* wasm2js: Bulk memory support (#2923)Alon Zakai2020-06-221-0/+4
| | | | | | | | | | | | | | Adds a special helper functions for data.drop etc., as unlike most wasm instructions these are too big to emit inline. Track passive segments at runtime in var memorySegments whose indexes are the segment indexes. Emit var bufferView even if the memory exists even without memory segments, as we do still need the view in order to operate on it. Also adds a few constants for atomics that will be useful in future PRs (as this PR updates the constant lists anyhow).
* clang-tidy braces changes (#2075)Alon Zakai2019-05-011-53/+95
| | | 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-237/+370
| | | 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
* Code style improvements (#1868)Alon Zakai2019-01-151-3/+3
| | | | * Use modern T p = v; notation to initialize class fields * Use modern X() = default; notation for empty class constructors
* Cleanup shared constants (#1784)Sam Clegg2018-11-291-3/+0
|
* wasm2asm test generation (#1124)Thomas Lively2017-08-161-0/+1
| | | | | | | | | | | | | | | | | * Translate assert_return invokes to asm * Translate assert_trap tests to JS * Enable wasm2asm tests * Fix wasm2asm translation of store * Update ubuntu nodejs in Travis * Free JSPrinter buffer * Use unique_ptr for Functions to prevent leaks * Add tests for assert translation
* wasm2asm i32 arithmetic support (#1120)Thomas Lively2017-08-071-0/+1
| | | * Rotations, popcnt, ctz, etc
* refactor asm.js ast to not use STAT nodes - we don't need to print the ↵Alon Zakai (kripken)2017-01-311-1/+0
| | | | asm.js anyhow, so knowing where ;s are is unnecessary bloat
* refactor asm.js ast to use an Assign nodeAlon Zakai (kripken)2017-01-311-1/+0
|
* refactor asm.js ast to use a string node directly instead of [NAME, string]Alon Zakai (kripken)2017-01-311-1/+0
|
* refactor asm.js ast to use a number node directly instead of [NUM, number]Alon Zakai (kripken)2017-01-301-1/+0
|
* asm2wasm i64 support (#723)Alon Zakai2016-09-301-2/+10
| | | | | | | | | | | | * support i64 intrinsics from fastcomp, adding --wasm-only flag * refactor callImport logic in asm2wasm to avoid recomputing wasm types again * legalize illegal i64 params in exports and imports * do safe i64 binary ops depending on precision * fix addVar, only assert on names if we are using a name
* Fixes typo in hex number parsing in asm2wasm. (#362)Yury Delendik2016-04-181-1/+1
| | | Fixes #352
* AST Builder class, and use it to optimzie umoddi4 in asm2wasmAlon Zakai2016-04-081-0/+2
|
* optimize llvm.cttz.i32 into i32.ctzAlon Zakai2016-04-081-0/+1
|
* Add Travis builds with sanitizersJF Bastien2016-01-101-9/+9
| | | | | | | | | | | | | | | | This triggers 5 independent build / test runs: - clang, no sanitizer; - clang, UB sanitizer; - clang, address sanitizer (disabled for now); - clang, thread sanitizer (disabled for now); - GCC. Enabling UBSan led to these changes: - Fix a bunch of undefined behavior throughout the code base. - Fix some tests that relied on that undefined behavior. - Make some of the tests easier to debug by printing their command line. - Add ubsan blacklist to work around libstdc++ bug. - Example testcase also needs sanitizer because libsupport.a uses it.
* parse for loops in asm2wasm #60Alon Zakai2016-01-041-0/+21
|
* Fix / uniformize include guardsJF Bastien2015-12-221-3/+3
|
* Fix the license headersJF Bastien2015-12-211-1/+16
| | | | 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.
* parser update from emscriptenAlon Zakai2015-11-171-0/+10
|
* restructure code, put emscripten-optimizer stuff in its own dirAlon Zakai2015-11-091-0/+905