diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 72ad459d3..499c1bf6c 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -508,12 +508,14 @@ private: void applyMemoryToModule() { // Memory must have already been flattened into the standard form: one // segment at offset 0, or none. + auto& memory = wasm->memories[0]; if (wasm->dataSegments.empty()) { Builder builder(*wasm); auto curr = builder.makeDataSegment(); - curr->offset = builder.makeConst(int32_t(0)); + curr->offset = + builder.makeConst(Literal::makeFromInt32(0, memory->indexType)); curr->setName(Name::fromInt(0), false); - curr->memory = wasm->memories[0]->name; + curr->memory = memory->name; wasm->addDataSegment(std::move(curr)); } auto& segment = wasm->dataSegments[0]; @@ -521,7 +523,7 @@ private: // Copy the current memory contents after execution into the Module's // memory. - segment->data = memories[wasm->memories[0]->name]; + segment->data = memories[memory->name]; } // Serializing GC data requires more work than linear memory, because |