diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/RemoveUnusedModuleElements.cpp | 3 | ||||
-rw-r--r-- | src/wasm-interpreter.h | 8 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index 93cc33563..9449f9034 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -364,8 +364,7 @@ struct RemoveUnusedModuleElements : public Pass { ModuleElement(ModuleElementKind::Tag, curr->name)) == 0; }); module->removeElementSegments([&](ElementSegment* curr) { - return curr->data.empty() || - analyzer.reachable.count(ModuleElement( + return analyzer.reachable.count(ModuleElement( ModuleElementKind::ElementSegment, curr->name)) == 0; }); // Since we've removed all empty element segments, here we mark all tables diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 165bfd18a..6e75794aa 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -3510,8 +3510,8 @@ public: return sizeFlow; } - auto offset = offsetFlow.getSingleValue().geti32(); - auto size = sizeFlow.getSingleValue().geti32(); + uint64_t offset = offsetFlow.getSingleValue().getUnsigned(); + uint64_t size = sizeFlow.getSingleValue().getUnsigned(); auto heapType = curr->type.getHeapType(); const auto& element = heapType.getArray().element; @@ -3526,7 +3526,7 @@ public: assert(elemType.isNumber()); const auto& seg = *wasm.dataSegments[curr->segment]; auto elemBytes = element.getByteSize(); - auto end = (uint64_t)offset + size * elemBytes; + auto end = offset + size * elemBytes; if ((size != 0ull && droppedSegments.count(curr->segment)) || end > seg.data.size()) { trap("out of bounds segment access in array.new_data"); @@ -3541,7 +3541,7 @@ public: case NewElem: { assert(curr->segment < wasm.elementSegments.size()); const auto& seg = *wasm.elementSegments[curr->segment]; - auto end = (uint64_t)offset + size; + auto end = offset + size; // TODO: Handle dropped element segments once we support those. if (end > seg.data.size()) { trap("out of bounds segment access in array.new_elem"); |