diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2021-11-03 14:44:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 21:44:59 +0000 |
commit | ab66e9ab1210a87d1db8ebe93cf8463eafe34e33 (patch) | |
tree | 2b28bd76b12f35420c77d3e3526f1d18b9a847e2 /src/wasm-builder.h | |
parent | 7b75f93898d37a87f16ef603b1c24def6ad6d9e4 (diff) | |
download | binaryen-ab66e9ab1210a87d1db8ebe93cf8463eafe34e33.tar.gz binaryen-ab66e9ab1210a87d1db8ebe93cf8463eafe34e33.tar.bz2 binaryen-ab66e9ab1210a87d1db8ebe93cf8463eafe34e33.zip |
Fix RTTs for RTT-less instructions (#4294)
Allocation and cast instructions without explicit RTTs should use the canonical
RTTs for the given types. Furthermore, the RTTs for nominal types should reflect
the static type hierarchy. Previously, however, we implemented allocations and
casts without RTTs using an alternative system that only used static types
rather than RTT values. This alternative system would work fine in a world
without first-class RTTs, but it did not properly allow mixing instructions that
use RTTs and instructions that do not use RTTs as intended by the M4 GC spec.
This PR fixes the issue by using canonical RTTs where appropriate and cleans up
the relevant casting code using std::variant.
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r-- | src/wasm-builder.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h index b192afbac..5914a8afd 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -837,7 +837,7 @@ public: } RttCanon* makeRttCanon(HeapType heapType) { auto* ret = wasm.allocator.alloc<RttCanon>(); - ret->type = Type(Rtt(0, heapType)); + ret->type = Type(Rtt(heapType.getDepth(), heapType)); ret->finalize(); return ret; } |