summaryrefslogtreecommitdiff
path: root/src/ir/table-utils.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix FlatTable for table64 (#6598)Sam Clegg2024-05-151-1/+1
|
* Directize: Handle overflows and out of bounds (#6255)Alon Zakai2024-01-301-1/+8
|
* Modernize code to C++17 (#3104)Max Graey2021-11-221-6/+2
|
* Support specialized function types in element segments (#4109)Alon Zakai2021-09-021-0/+5
| | | | | | Before this, the element segments would be printed as having type funcref, and then if their table had a specialized type, the element type would not be a subtype of the table and validation would fail.
* Preserve Function HeapTypes (#3952)Thomas Lively2021-06-301-1/+1
| | | | | | | | | When using nominal types, func.ref of two functions with identical signatures but different HeapTypes will yield different types. To preserve these semantics, Functions need to track their HeapTypes, not just their Signatures. This PR replaces the Signature field in Function with a HeapType field and adds new utility methods to make it almost as simple to update and query the function HeapType as it was to update and query the Function Signature.
* wasm-split: Update dylink section when growing table (#3791)Sam Clegg2021-04-091-1/+1
|
* RefFunc: Validate that the type is non-nullable, and avoid possible bugs in ↵Alon Zakai2021-04-081-3/+1
| | | | | | | | the builder (#3790) The builder can receive a HeapType so that callers don't need to set non-nullability themselves. Not NFC as some of the callers were in fact still making it nullable.
* [RT] Add type to tables and element segments (#3763)Abbas Mashayekh2021-04-061-1/+1
|
* [RT] Support expressions in element segments (#3666)Abbas Mashayekh2021-03-241-6/+13
| | | | | | This PR adds support for `ref.null t` as a valid element segment item. The abbreviated format of `(elem ... func $f $g...)` is kept in both printing and binary emitting if all items are `ref.func`s. Public APIs aren't updated in this PR.
* [reference-types] Support passive elem segments (#3572)Abbas Mashayekh2021-03-051-27/+34
| | | | | | | | | | | Passive element segments do not belong to any table, so the link between Table and elem needs to be weaker; i.e. an elem may have a table in case of active segments, or simply be a collection of function references in case of passive/declarative segments. This PR takes Table::Segment out and turns it into a first class module element just like tables and functions. It also implements early support for parsing, printing, encoding and decoding passive/declarative elem segments.
* Emit "elem declare" for functions that need it (#3653)Alon Zakai2021-03-041-0/+4
| | | | | | | This adds support for reading (elem declare func $foo .. in the text and binary formats. We can simply ignore it: we don't need to represent it in IR, rather we find what needs to be declared when writing. That part takes a little more work, for which this adds a shared helper function.
* Avoid unnecessary fp$ in side modules (#2717)Alon Zakai2020-03-311-11/+4
| | | | | | | | | | | | | | | | Now that we update the dylink section properly, we can do the same optimization in side modules as in main ones: if the module provides a function, don't call an $fp method during startup, instead add it to the table ourselves and use the relative offset to the table base. Fix an issue when the table has no segments initially: the code just added an offset of 0, but that's not right. Instead, an a __table_base import and use that as the offset. As this is ABI-specific I did it on wasm-emscripten-finalize, leaving TableUtils to just assert on having a singleton segment. Add a test of a wasm file with a dylink section to the lld tests.
* Represent dylink section in IR, so we can update it. (#2715)Alon Zakai2020-03-301-1/+14
| | | | Update it from wasm-emscripten-finalize when we append to the table.
* Avoid fp$ access in MAIN_MODULES (#2704)Alon Zakai2020-03-271-0/+43
| | | | | | | | | | | | | | | | Depends on emscripten-core/emscripten#10741 which ensures that table indexes are unique. With that guarantee, a main module can just add its function pointers into the table, and use them based on that index. The loader will then see them in the table and then give other modules the identical function pointer for a function, ensuring function pointer equality. This avoids calling fp$ functions during startup for the main module's own functions (which are slow). We do still call fp$s of things we import from outside, as we don't have anything to put in the table for them, we depend on the loader for that. I suspect this can also be done with SIDE_MODULES, but did not want to try too much at once.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-1/+1
| | | 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
* Use a single table in wasm2js (#2005)Alon Zakai2019-04-151-0/+52
This replaces the multiple asm.js tables (of power-of-2 size) with a single simple table. Also supports importing the table.