Skip to content

Commit 42714c9

Browse files
wip
1 parent 7699b35 commit 42714c9

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/ir/child-typer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,8 +1361,13 @@ template<typename Subtype> struct ChildTyper : OverriddenVisitor<Subtype> {
13611361
void visitStructWait(StructWait* curr,
13621362
std::optional<HeapType> ht = std::nullopt) {
13631363
if (!ht) {
1364+
if (!curr->structType.isStruct()) {
1365+
self().noteUnknown();
1366+
return;
1367+
}
13641368
ht = curr->structType;
13651369
}
1370+
13661371
note(&curr->ref, Type(*ht, Nullable));
13671372
note(&curr->expected, Type(Type::BasicType::i32));
13681373
note(&curr->timeout, Type(Type::BasicType::i64));

src/ir/effects.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,13 +1165,19 @@ class EffectAnalyzer {
11651165
parent.mayNotReturn = true;
11661166
parent.implicitTrap = true;
11671167

1168-
// if (curr->)
1168+
if (curr->ref->type == Type::unreachable) {
1169+
return;
1170+
}
11691171

1170-
// field must exist and be a packed waitqueue if this is valid Wasm.
1171-
if (curr->structType.isStruct() &&
1172-
curr->index < curr->structType.getStruct().fields.size() &&
1173-
curr->structType.getStruct().fields.at(curr->index).mutable_ ==
1174-
Mutable) {
1172+
// If the ref isn't `unreachable`, then the field must exist and be a
1173+
// packed waitqueue due to validation.
1174+
if (curr->ref->type.isStruct() &&
1175+
curr->index <
1176+
curr->ref->type.getHeapType().getStruct().fields.size() &&
1177+
curr->ref->type.getHeapType()
1178+
.getStruct()
1179+
.fields.at(curr->index)
1180+
.mutable_ == Mutable) {
11751181
parent.readsMutableStruct = true;
11761182
}
11771183
}

0 commit comments

Comments
 (0)