diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/c-writer.cc | 3 | ||||
-rw-r--r-- | src/interp/interp.cc | 6 | ||||
-rw-r--r-- | src/type-checker.cc | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/src/c-writer.cc b/src/c-writer.cc index 2c3eb429..df8c037b 100644 --- a/src/c-writer.cc +++ b/src/c-writer.cc @@ -1100,6 +1100,9 @@ void CWriter::WriteElemInitializers() { } Index elem_segment_index = 0; for (const ElemSegment* elem_segment : module_->elem_segments) { + if (elem_segment->kind == SegmentKind::Passive) { + continue; + } Write("offset = "); WriteInitExpr(elem_segment->offset); Write(";", Newline()); diff --git a/src/interp/interp.cc b/src/interp/interp.cc index 05a40bd4..e5daa6fe 100644 --- a/src/interp/interp.cc +++ b/src/interp/interp.cc @@ -456,6 +456,9 @@ Result Table::Grow(Store& store, u32 count, Ref ref) { u32 new_size; if (store.HasValueType(ref, type_.element) && CanGrow<u32>(type_.limits, old_size, count, &new_size)) { + // Grow the limits of the table too, so that if it is used as an + // import to another module its new size is honored. + type_.limits.initial += count; elements_.resize(new_size); Fill(store, old_size, ref, new_size - old_size); return Result::Ok; @@ -529,6 +532,9 @@ Result Memory::Match(class Store& store, Result Memory::Grow(u64 count) { u64 new_pages; if (CanGrow<u64>(type_.limits, pages_, count, &new_pages)) { + // Grow the limits of the memory too, so that if it is used as an + // import to another module its new size is honored. + type_.limits.initial += count; #if WABT_BIG_ENDIAN auto old_size = data_.size(); #endif diff --git a/src/type-checker.cc b/src/type-checker.cc index 3e875a31..9453dee2 100644 --- a/src/type-checker.cc +++ b/src/type-checker.cc @@ -492,7 +492,7 @@ Result TypeChecker::OnCallIndirect(const TypeVector& param_types, Result TypeChecker::OnFuncRef(Index* out_index) { Type type; Result result = PeekType(0, &type); - if (!type.IsIndex()) { + if (!(type == Type::Any || type.IsIndex())) { TypeVector actual; if (Succeeded(result)) { actual.push_back(type); @@ -766,7 +766,7 @@ Result TypeChecker::OnRefNullExpr(Type type) { Result TypeChecker::OnRefIsNullExpr() { Type type; Result result = PeekType(0, &type); - if (!type.IsRef()) { + if (!(type == Type::Any || type.IsRef())) { TypeVector actual; if (Succeeded(result)) { actual.push_back(type); |