mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1590083: Disable wasm multi value with Cranelift; r=lth
Since wasm multi-value is enabled by default (without a shell switch), there was no way to signal it was disabled in certain configurations, namely Cranelift. Instead, assume multi-value is enabled by default and disable it with Cranelift, and store this information in the CompilerEnvironment so we can use it when iterating on the wasm binary. Differential Revision: https://phabricator.services.mozilla.com/D49925 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
03190f48a2
commit
7f73b2f797
@ -234,13 +234,12 @@ assertErrorMessage(() => wasmEval(moduleWithSections([
|
||||
for (var bad of [0xff, 1, 0x3f])
|
||||
assertErrorMessage(() => wasmEval(moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, bad, EndCode]})])])), CompileError, /invalid .*block type/);
|
||||
|
||||
const multiValueModule = moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, 0, EndCode]})])]);
|
||||
if (wasmMultiValueEnabled()) {
|
||||
// In this test module, 0 denotes a void-to-void block type.
|
||||
let binary = moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, 0, EndCode]})])]);
|
||||
assertEq(WebAssembly.validate(binary), true);
|
||||
assertEq(WebAssembly.validate(multiValueModule), true);
|
||||
} else {
|
||||
const bad = 0;
|
||||
assertErrorMessage(() => wasmEval(moduleWithSections([sigSection([v2vSig]), declSection([0]), bodySection([funcBody({locals:[], body:[BlockCode, bad, EndCode]})])])), CompileError, /invalid .*block type/);
|
||||
assertErrorMessage(() => wasmEval(multiValueModule), CompileError, /invalid .*block type/);
|
||||
}
|
||||
|
||||
// Ensure all invalid opcodes rejected
|
||||
|
@ -447,6 +447,7 @@ CompilerEnvironment::CompilerEnvironment(CompileMode mode, Tier tier,
|
||||
debug_(debugEnabled),
|
||||
refTypes_(refTypesConfigured),
|
||||
gcTypes_(gcTypesConfigured),
|
||||
multiValues_(true),
|
||||
hugeMemory_(hugeMemory) {}
|
||||
|
||||
void CompilerEnvironment::computeParameters(bool gcFeatureOptIn) {
|
||||
@ -503,6 +504,7 @@ void CompilerEnvironment::computeParameters(Decoder& d, bool gcFeatureOptIn) {
|
||||
debug_ = debugEnabled ? DebugEnabled::True : DebugEnabled::False;
|
||||
gcTypes_ = gcEnabled;
|
||||
refTypes_ = !craneliftEnabled;
|
||||
multiValues_ = !craneliftEnabled;
|
||||
hugeMemory_ = hugeMemory;
|
||||
state_ = Computed;
|
||||
}
|
||||
|
@ -1165,6 +1165,10 @@ inline bool OpIter<Policy>::readBlockType(BlockType* type) {
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WASM_MULTI_VALUE
|
||||
if (!env_.multiValuesEnabled()) {
|
||||
return fail("invalid block type reference");
|
||||
}
|
||||
|
||||
int32_t x;
|
||||
if (!d_.readVarS32(&x) || x < 0 || uint32_t(x) >= env_.types.length()) {
|
||||
return fail("invalid block type type index");
|
||||
|
@ -71,6 +71,7 @@ struct CompilerEnvironment {
|
||||
DebugEnabled debug_;
|
||||
bool refTypes_;
|
||||
bool gcTypes_;
|
||||
bool multiValues_;
|
||||
bool hugeMemory_;
|
||||
};
|
||||
};
|
||||
@ -121,6 +122,10 @@ struct CompilerEnvironment {
|
||||
MOZ_ASSERT(isComputed());
|
||||
return refTypes_;
|
||||
}
|
||||
bool multiValues() const {
|
||||
MOZ_ASSERT(isComputed());
|
||||
return multiValues_;
|
||||
}
|
||||
bool hugeMemory() const {
|
||||
MOZ_ASSERT(isComputed());
|
||||
return hugeMemory_;
|
||||
@ -209,6 +214,7 @@ struct ModuleEnvironment {
|
||||
}
|
||||
bool gcTypesEnabled() const { return compilerEnv->gcTypes(); }
|
||||
bool refTypesEnabled() const { return compilerEnv->refTypes(); }
|
||||
bool multiValuesEnabled() const { return compilerEnv->multiValues(); }
|
||||
bool usesMemory() const { return memoryUsage != MemoryUsage::None; }
|
||||
bool usesSharedMemory() const { return memoryUsage == MemoryUsage::Shared; }
|
||||
bool isAsmJS() const { return kind == ModuleKind::AsmJS; }
|
||||
|
Loading…
Reference in New Issue
Block a user