@@ -997,8 +997,9 @@ template<typename Subtype> struct ChildTyper : OverriddenVisitor<Subtype> {
997
997
const auto & fields = ht->getStruct ().fields ;
998
998
assert (curr->index < fields.size ());
999
999
note (&curr->ref , Type (*ht, Nullable));
1000
- note (&curr->expected , fields[curr->index ].type );
1001
- note (&curr->replacement , fields[curr->index ].type );
1000
+ auto type = fields[curr->index ].type ;
1001
+ note (&curr->expected , type.isRef () ? Type (HeapType::eq, Nullable) : type);
1002
+ note (&curr->replacement , type);
1002
1003
}
1003
1004
1004
1005
void visitArrayNew (ArrayNew* curr) {
@@ -1126,6 +1127,35 @@ template<typename Subtype> struct ChildTyper : OverriddenVisitor<Subtype> {
1126
1127
note (&curr->size , Type::i32 );
1127
1128
}
1128
1129
1130
+ void visitArrayRMW (ArrayRMW* curr,
1131
+ std::optional<HeapType> ht = std::nullopt ) {
1132
+ if (!ht) {
1133
+ if (self ().skipUnreachable () && !curr->ref ->type .isRef ()) {
1134
+ return ;
1135
+ }
1136
+ ht = curr->ref ->type .getHeapType ();
1137
+ }
1138
+ auto type = ht->getArray ().element .type ;
1139
+ note (&curr->ref , Type (*ht, Nullable));
1140
+ note (&curr->index , Type::i32 );
1141
+ note (&curr->value , type);
1142
+ }
1143
+
1144
+ void visitArrayCmpxchg (ArrayCmpxchg* curr,
1145
+ std::optional<HeapType> ht = std::nullopt ) {
1146
+ if (!ht) {
1147
+ if (self ().skipUnreachable () && !curr->ref ->type .isRef ()) {
1148
+ return ;
1149
+ }
1150
+ ht = curr->ref ->type .getHeapType ();
1151
+ }
1152
+ auto type = ht->getArray ().element .type ;
1153
+ note (&curr->ref , Type (*ht, Nullable));
1154
+ note (&curr->index , Type::i32 );
1155
+ note (&curr->expected , type.isRef () ? Type (HeapType::eq, Nullable) : type);
1156
+ note (&curr->replacement , type);
1157
+ }
1158
+
1129
1159
void visitRefAs (RefAs* curr) {
1130
1160
switch (curr->op ) {
1131
1161
case RefAsNonNull:
0 commit comments