Skip to content

Commit e98d5e6

Browse files
Fix ordering
1 parent 4658e23 commit e98d5e6

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/wasm-interpreter.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3311,12 +3311,15 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
33113311
importedInstance->wasm.getExportOrNull((*memory)->base);
33123312
Memory exportedMemory =
33133313
*importedInstance->wasm.getMemory(*export_->getInternalName());
3314-
exportedMemory.initial = importedInstance->getMemorySize();
3315-
// Address initial = importedInstance->getMemorySize();
3316-
if (!(*memory)->isSubType(*exportedMemory)) {
3314+
// exportedMemory.initial =
3315+
// importedInstance->getMemorySize(*export_->getInternalName());
3316+
3317+
// todo which way?
3318+
// if (!(*memory)->isSubType(exportedMemory)) {
3319+
if (!exportedMemory.isSubType(**memory)) {
33173320
trap((std::stringstream()
33183321
<< "Imported memory isn't compatible. Imported memory: "
3319-
<< **memory << ". Exported memory: " << *exportedMemory)
3322+
<< **memory << ". Exported memory: " << exportedMemory)
33203323
.str());
33213324
}
33223325
}

src/wasm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,8 +2494,8 @@ class Memory : public Importable {
24942494
}
24952495

24962496
static bool isSubType(const Memory& a, const Memory& b) {
2497-
return a.addressType == b.addressType && a.initial <= b.initial &&
2498-
a.max >= b.max;
2497+
return a.addressType == b.addressType && a.initial >= b.initial &&
2498+
a.max <= b.max;
24992499
}
25002500

25012501
bool isSubType(const Memory& other) {

0 commit comments

Comments
 (0)