summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-binary.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 6cbf880e3..c161a623b 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -223,7 +223,12 @@ void WasmBinaryWriter::writeTypes() {
// the type section. With nominal typing there is always one group and with
// equirecursive typing there is one group per type.
size_t numGroups = 0;
- switch (getTypeSystem()) {
+ // MVP types are structural and do not use recursion groups.
+ TypeSystem typeSystem = getTypeSystem();
+ if (!wasm->features.hasGC()) {
+ typeSystem = TypeSystem::Equirecursive;
+ }
+ switch (typeSystem) {
case TypeSystem::Equirecursive:
numGroups = indexedTypes.types.size();
break;
@@ -242,7 +247,7 @@ void WasmBinaryWriter::writeTypes() {
BYN_TRACE("== writeTypes\n");
auto start = startSection(BinaryConsts::Section::Type);
o << U32LEB(numGroups);
- if (getTypeSystem() == TypeSystem::Nominal) {
+ if (typeSystem == TypeSystem::Nominal) {
// The nominal recursion group contains every type.
o << S32LEB(BinaryConsts::EncodedType::Rec)
<< U32LEB(indexedTypes.types.size());