diff options
author | Thomas Lively <tlively@google.com> | 2022-12-20 09:52:54 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 07:52:54 -0800 |
commit | 569f789622f116177c8a1e32fb62a4e5a5c9dfe0 (patch) | |
tree | 3a67097f753f3a22a1ebde6cd4f50c532e773663 /src/wasm/wasm-validator.cpp | |
parent | 12ad604c17407f6b36d52c6404f2dab32e5c7960 (diff) | |
download | binaryen-569f789622f116177c8a1e32fb62a4e5a5c9dfe0.tar.gz binaryen-569f789622f116177c8a1e32fb62a4e5a5c9dfe0.tar.bz2 binaryen-569f789622f116177c8a1e32fb62a4e5a5c9dfe0.zip |
Update RefCast representation to drop extra HeapType (#5350)
The latest upstream version of ref.cast is parameterized with a target reference
type, not just a heap type, because the nullability of the result is
parameterizable. As a first step toward implementing these new, more flexible
ref.cast instructions, change the internal representation of ref.cast to use the
expression type as the cast target rather than storing a separate heap type
field. For now require that the encoded semantics match the previously allowed
semantics, though, so that none of the optimization passes need to be updated.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 726c70c7c..b102ecb1c 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2530,10 +2530,16 @@ void FunctionValidator::visitRefCast(RefCast* curr) { return; } shouldBeEqual( - curr->intendedType.getBottom(), + curr->type.getHeapType().getBottom(), curr->ref->type.getHeapType().getBottom(), curr, "ref.cast target type and ref type must have a common supertype"); + + // TODO: Remove this restriction + shouldBeEqual(curr->type.getNullability(), + curr->ref->type.getNullability(), + curr, + "ref.cast to a different nullability not yet implemented"); } void FunctionValidator::visitBrOn(BrOn* curr) { |