summaryrefslogtreecommitdiff
path: root/src/passes/InstrumentMemory.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename indexType -> addressType. NFC (#7060)Sam Clegg2024-11-071-12/+16
| | | See https://github.com/WebAssembly/memory64/pull/92
* Automatically discard global effects in the rare passes that add effects (#5999)Alon Zakai2023-10-061-0/+3
| | | | | All logging/instrumentation passes need to do this, to avoid us using stale global effects that are too low (too high is not optimal either, but at least it cannot cause bugs).
* Mutli-Memories Support in IR (#4811)Ashley Nelson2022-08-171-5/+8
| | | | | | | This PR removes the single memory restriction in IR, adding support for a single module to reference multiple memories. To support this change, a new memory name field was added to 13 memory instructions in order to identify the memory for the instruction. It is a goal of this PR to maintain backwards compatibility with existing text and binary wasm modules, so memory indexes remain optional for memory instructions. Similarly, the JS API makes assumptions about which memory is intended when only one memory is present in the module. Another goal of this PR is that existing tests behavior be unaffected. That said, tests must now explicitly define a memory before invoking memory instructions or exporting a memory, and memory names are now printed for each memory instruction in the text format. There remain quite a few places where a hardcoded reference to the first memory persist (memory flattening, for example, will return early if more than one memory is present in the module). Many of these call-sites, particularly within passes, will require us to rethink how the optimization works in a multi-memories world. Other call-sites may necessitate more invasive code restructuring to fully convert away from relying on a globally available, single memory pointer.
* Remove RTTs (#4848)Thomas Lively2022-08-051-1/+1
| | | | | | | RTTs were removed from the GC spec and if they are added back in in the future, they will be heap types rather than value types as in our implementation. Updating our implementation to have RTTs be heap types would have been more work than deleting them for questionable benefit since we don't know how long it will be before they are specced again.
* [Wasm GC] Add Wasm GC support to InstrumentMemory (#3976)Alon Zakai2021-07-151-0/+135
| | | | | | | | This adds calls to imports around every struct load and store, to note their values, and also to arrays (where it also notes the index). This has been very useful in debugging LowerGC (lowering of Wasm GC to wasm MVP).
* Preserve Function HeapTypes (#3952)Thomas Lively2021-06-301-4/+2
| | | | | | | | | 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.
* Remove dead code and unused includes. NFC. (#3328)Sam Clegg2020-11-081-1/+0
| | | Specifically try to cleanup use of asm_v_wasm.h and asmjs constants.
* Initial implementation of "Memory64" proposal (#3130)Wouter van Oortmerssen2020-09-181-6/+11
| | | Also includes a lot of new spec tests that eventually need to go into the spec repo
* Prepare for compound types that are single but not basic (#3046)Daniel Wirtz2020-08-171-2/+2
| | | | | | | | | | | | | | 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.
* Add a builder.makeConst helper template (#2971)Alon Zakai2020-07-211-19/+15
|
* Remove implicit conversion operators from Type (#2577)Thomas Lively2020-01-081-2/+2
| | | | | | | | | | * 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-10/+10
|
* Remove FunctionType (#2510)Thomas Lively2019-12-111-15/+14
| | | | | | | | | | | | | | | | | 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.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-66/+72
| | | 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
* Improve instrumentation passes (#2012)Alon Zakai2019-04-161-51/+92
| | | | | * Make the memory instrumentation pass log both pointers and values. * Use "env" as the import module - simpler to support and get working.
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-6/+8
| | | | | | | | | | | | | | 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.
* Optimizer support for atomic instructions (#1094)Derek Schuff2017-07-211-0/+1
| | | | | | * Teach EffectAnalyzer not to reorder atomics wrt other memory operations. * Teach EffectAnalyzer not to reorder host operations with memory operations * Teach various passes about the operands of AtomicRMW and AtomicCmpxchg * Factor out some functions in DeadCodeElimination and MergeBlocks
* Add pass to instrument loads / stores. (#959)Michael Bebenita2017-04-291-0/+123
* Add pass to instrument loads / stores * Simplify instrumentation. * Document.