Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe01812

Browse filesBrowse files
authored
Move assert in MultiMemoryLowering (#5376)
Moved the assert that checks whether the DataSegment* offset type is Const. This assert only needs to happen when the DataSegment belongs to a memory other than the first.
1 parent 4a8a4b8 commit fe01812
Copy full SHA for fe01812

1 file changed

+6-3Lines changed: 6 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/passes/MultiMemoryLowering.cpp‎

Copy file name to clipboardExpand all lines: src/passes/MultiMemoryLowering.cpp
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,17 +468,20 @@ struct MultiMemoryLowering : public Pass {
468468
}
469469
}
470470

471+
// TODO: Add a trap for segments that have a non-constant offset that would
472+
// have been out of bounds at runtime but is in bounds after multi-memory
473+
// lowering
471474
void adjustActiveDataSegmentOffsets() {
472475
Builder builder(*wasm);
473476
ModuleUtils::iterActiveDataSegments(*wasm, [&](DataSegment* dataSegment) {
474-
assert(dataSegment->offset->is<Const>() &&
475-
"TODO: handle non-const segment offsets");
476477
auto idx = memoryIdxMap.at(dataSegment->memory);
477478
dataSegment->memory = combinedMemory;
478479
// No need to update the offset of data segments for the first memory
479480
if (idx != 0) {
480-
auto offsetGlobalName = getOffsetGlobal(idx);
481+
assert(dataSegment->offset->is<Const>() &&
482+
"TODO: handle non-const segment offsets");
481483
assert(wasm->features.hasExtendedConst());
484+
auto offsetGlobalName = getOffsetGlobal(idx);
482485
dataSegment->offset = builder.makeBinary(
483486
Abstract::getBinary(pointerType, Abstract::Add),
484487
builder.makeGlobalGet(offsetGlobalName, pointerType),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.