mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1471500 - Complete initial implementation of the bulk-memory proposal. Part 1 of 10. r=bbouvier.
Fixes a couple of bugs in existing code: * module.js: one of the tests checks the result of parsing a prefix without any opcode following. This test is wrong because funcBody(), used to build the body, adds End (0x0B) to the block. But MiscPrefix:EndCode (0xFC:0x0B) is actually "memory.fill", so the test tests the wrong thing. I added a new optional parameter to funcBody() to allow omission of the automatic End value. * AstMemCopy::AstMemCopy and AstMemFill::AstMemFill state the wrong result type, ExprType::I32, for the instruction. It should be ExprType::Void. --HG-- extra : rebase_source : 08898f2027f35414f4356140aab254f93fa72a62
This commit is contained in:
parent
f1fe1e77c9
commit
8ab050214b
@ -205,12 +205,13 @@ function declSection(decls) {
|
||||
return { name: functionId, body };
|
||||
}
|
||||
|
||||
function funcBody(func) {
|
||||
function funcBody(func, withEndCode=true) {
|
||||
var body = varU32(func.locals.length);
|
||||
for (let local of func.locals)
|
||||
body.push(...varU32(local));
|
||||
body = body.concat(...func.body);
|
||||
body.push(EndCode);
|
||||
if (withEndCode)
|
||||
body.push(EndCode);
|
||||
body.splice(0, 0, ...varU32(body.length));
|
||||
return body;
|
||||
}
|
||||
|
@ -299,9 +299,10 @@ for (let i = 0; i < 256; i++)
|
||||
checkIllegalPrefixed(MozPrefix, i);
|
||||
|
||||
for (let prefix of [ThreadPrefix, MiscPrefix, SimdPrefix, MozPrefix]) {
|
||||
// Prefix without a subsequent opcode
|
||||
let binary = moduleWithSections([v2vSigSection, declSection([0]), bodySection([funcBody({locals:[], body:[prefix]})])]);
|
||||
assertErrorMessage(() => wasmEval(binary), CompileError, /unrecognized opcode/);
|
||||
// Prefix without a subsequent opcode. We must ask funcBody not to add an
|
||||
// End code after the prefix, so the body really is just the prefix byte.
|
||||
let binary = moduleWithSections([v2vSigSection, declSection([0]), bodySection([funcBody({locals:[], body:[prefix]}, /*withEndCode=*/false)])]);
|
||||
assertErrorMessage(() => wasmEval(binary), CompileError, /unable to read opcode/);
|
||||
assertEq(WebAssembly.validate(binary), false);
|
||||
}
|
||||
|
||||
|
@ -960,7 +960,7 @@ class AstMemCopy : public AstExpr
|
||||
public:
|
||||
static const AstExprKind Kind = AstExprKind::MemCopy;
|
||||
explicit AstMemCopy(AstExpr* dest, AstExpr* src, AstExpr* len)
|
||||
: AstExpr(Kind, ExprType::I32),
|
||||
: AstExpr(Kind, ExprType::Void),
|
||||
dest_(dest),
|
||||
src_(src),
|
||||
len_(len)
|
||||
@ -980,7 +980,7 @@ class AstMemFill : public AstExpr
|
||||
public:
|
||||
static const AstExprKind Kind = AstExprKind::MemFill;
|
||||
explicit AstMemFill(AstExpr* start, AstExpr* val, AstExpr* len)
|
||||
: AstExpr(Kind, ExprType::I32),
|
||||
: AstExpr(Kind, ExprType::Void),
|
||||
start_(start),
|
||||
val_(val),
|
||||
len_(len)
|
||||
|
Loading…
Reference in New Issue
Block a user