summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-08-29 12:48:46 -0700
committerGitHub <noreply@github.com>2022-08-29 12:48:46 -0700
commitbd630d707253a9838a3d0306e4be680942ff0715 (patch)
treeb51a786d3afd3ee97a78eb0d3923fb6ad59565d5 /src/wasm/wasm.cpp
parent8108ce28e66f1002932f6e5dc9dd4f23c8b8a9f3 (diff)
downloadbinaryen-bd630d707253a9838a3d0306e4be680942ff0715.tar.gz
binaryen-bd630d707253a9838a3d0306e4be680942ff0715.tar.bz2
binaryen-bd630d707253a9838a3d0306e4be680942ff0715.zip
Implement `extern.externalize` and `extern.internalize` (#4975)
These new GC instructions infallibly convert between `extern` and `any` references now that those types are not in the same hierarchy.
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 8226e9079..56db8d7a9 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -1122,6 +1122,12 @@ void RefAs::finalize() {
case RefAsI31:
type = Type(HeapType::i31, NonNullable);
break;
+ case ExternInternalize:
+ type = Type(HeapType::any, value->type.getNullability());
+ break;
+ case ExternExternalize:
+ type = Type(HeapType::ext, value->type.getNullability());
+ break;
default:
WASM_UNREACHABLE("invalid ref.as_*");
}