diff options
author | Alon Zakai <azakai@google.com> | 2021-08-09 13:25:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 13:25:09 -0700 |
commit | 329b3606b7f966f1ac3cbb1f9a46849ea4d5c785 (patch) | |
tree | 278cf2a6b2d82f18700d6c40f82acf549c1e59fb /src/wasm-binary.h | |
parent | 832481af8af5ddefc3a3479701418f94a1a4921a (diff) | |
download | binaryen-329b3606b7f966f1ac3cbb1f9a46849ea4d5c785.tar.gz binaryen-329b3606b7f966f1ac3cbb1f9a46849ea4d5c785.tar.bz2 binaryen-329b3606b7f966f1ac3cbb1f9a46849ea4d5c785.zip |
[Wasm GC] Track struct.new and struct.set separately in ConstantFieldPropagation (#4064)
Previously we tracked them in the same way. That means that we did the same
when seeing if either a struct.new or a struct.set can write to the memory that
is read by a struct.get, where the rule is that if either type is a subtype of the
other then they might. But with struct.new we know the precise type, which
means we can do better.
Specifically, if we see a new of type B, then only a get of a supertype of B can
possibly read that data: it is not possible for our struct of type B to appear in
a location that requires a subtype of B. Conceptually:
A = type struct
B = type extends A
C = type extends B
x = struct.new<B>
struct.get<A>(y) // x might appear here, as it can be assigned to a
// variable y of a supertype
struct.get<C>(y) // x cannot appear here
This allows more devirtualization. It is a followup for #4052 that implements
a TODO from there.
The diff without whitespace is simpler.
Diffstat (limited to 'src/wasm-binary.h')
0 files changed, 0 insertions, 0 deletions