diff options
author | Thomas Lively <tlively@google.com> | 2024-06-18 18:20:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 01:20:49 +0000 |
commit | 2df678e4670517eaac40d1d2d9541d3b706b324b (patch) | |
tree | 3a47da6a20834dad1e43a8953ea428eb12fcb13c /src/passes | |
parent | 829e228d4b2ccb314ea1e653fd16154ae3fd31b3 (diff) | |
download | binaryen-2df678e4670517eaac40d1d2d9541d3b706b324b.tar.gz binaryen-2df678e4670517eaac40d1d2d9541d3b706b324b.tar.bz2 binaryen-2df678e4670517eaac40d1d2d9541d3b706b324b.zip |
[threads] Shared basic heap types (#6667)
Implement binary and text parsing and printing of shared basic heap types and
incorporate them into the type hierarchy.
To avoid the massive amount of code duplication that would be necessary if we
were to add separate enum variants for each of the shared basic heap types, use
bit 0 to indicate whether the type is shared and replace `getBasic()` with
`getBasic(Unshared)`, which clears that bit. Update all the use sites to record
whether the original type was shared and produce shared or unshared output
without code duplication.
Diffstat (limited to 'src/passes')
-rw-r--r-- | src/passes/TypeGeneralizing.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/passes/TypeGeneralizing.cpp b/src/passes/TypeGeneralizing.cpp index 81dd0a39e..720830400 100644 --- a/src/passes/TypeGeneralizing.cpp +++ b/src/passes/TypeGeneralizing.cpp @@ -58,7 +58,7 @@ using TypeRequirement = Inverted<ValType>; // Record a type requirement for each local variable. Shared the requirements // across basic blocks. -using LocalTypeRequirements = Shared<Vector<TypeRequirement>>; +using LocalTypeRequirements = SharedPath<Vector<TypeRequirement>>; // The type requirements for each reference-typed value on the stack at a // particular location. @@ -75,7 +75,8 @@ struct State : StateLattice { static constexpr int LocalsIndex = 0; static constexpr int StackIndex = 1; - State(Function* func) : StateLattice{Shared{initLocals(func)}, initStack()} {} + State(Function* func) + : StateLattice{SharedPath{initLocals(func)}, initStack()} {} void push(Element& elem, Type type) const noexcept { stackLattice().push(stack(elem), std::move(type)); @@ -109,7 +110,7 @@ struct State : StateLattice { private: static LocalTypeRequirements initLocals(Function* func) noexcept { - return Shared{Vector{Inverted{ValType{}}, func->getNumLocals()}}; + return SharedPath{Vector{Inverted{ValType{}}, func->getNumLocals()}}; } static ValueStackTypeRequirements initStack() noexcept { |