wasm/BinaryTransform: Fix wrong alignment for .load/.store with arguments smaller than 64-bits

This commit is contained in:
Kamil Śliwak
2020-06-06 00:00:46 +02:00
parent 325a78fe47
commit fe0a0802b2
7 changed files with 45 additions and 4 deletions
+6 -2
View File
@@ -336,8 +336,12 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call)
_call.functionName.find(".load") != string::npos ||
_call.functionName.find(".store") != string::npos
)
// alignment and offset
ret += bytes{{3, 0}};
// Alignment hint and offset. Interpreters ignore the alignment. JITs/AOTs can take it
// into account to generate more efficient code but if the hint is invalid it could
// actually be more expensive. It's best to hint at 1-byte alignment if we don't plan
// to control the memory layout accordingly.
ret += bytes{{0, 0}}; // 2^0 == 1-byte alignment
return ret;
}
}