Bug 1677204 - wasm: Remove multi-value flag. r=lth

Multi-value has shipped and can remove its feature flag.

Differential Revision: https://phabricator.services.mozilla.com/D110819
This commit is contained in:
Ryan Hunt 2021-04-09 20:03:51 +00:00
parent 12155b90b9
commit 90c8728cc9
19 changed files with 8 additions and 164 deletions

View File

@ -283,9 +283,6 @@ void LoadContextOptions(const char* aPrefName, void* /* aClosure */) {
#ifdef ENABLE_WASM_GC
.setWasmGc(GetWorkerPref<bool>("wasm_gc"_ns))
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
.setWasmMultiValue(GetWorkerPref<bool>("wasm_multi_value"_ns))
#endif
#ifdef ENABLE_WASM_SIMD
.setWasmSimd(GetWorkerPref<bool>("wasm_simd"_ns))
#endif

View File

@ -715,27 +715,6 @@ set_define(
depends_if("--enable-wasm-private-reftypes")(lambda x: True),
)
# Support for the WebAssembly multi-value proposal.
# Do not remove until Cranelift supports multi-value.
# =====================================================
option(
"--disable-wasm-multi-value",
help="Disable WebAssembly multi-value blocks and function calls",
)
@depends("--disable-wasm-multi-value")
def enable_wasm_multi_value(value):
if value:
return True
set_config("ENABLE_WASM_MULTI_VALUE", enable_wasm_multi_value)
set_define("ENABLE_WASM_MULTI_VALUE", enable_wasm_multi_value)
# Support for WebAssembly shared memory and atomics.
#
# This affects the JS shell only and here to allow the use of
@ -994,9 +973,9 @@ set_define(
# ==================================
@depends(milestone.is_nightly, "--enable-wasm-multi-value")
def default_wasm_exceptions(is_nightly, multi_value):
if multi_value and is_nightly:
@depends(milestone.is_nightly)
def default_wasm_exceptions(is_nightly):
if is_nightly:
return True

View File

@ -28,7 +28,6 @@ class JS_PUBLIC_API ContextOptions {
wasmReftypes_(true),
wasmFunctionReferences_(false),
wasmGc_(false),
wasmMultiValue_(false),
wasmSimd_(false),
wasmSimdWormhole_(false),
wasmExceptions_(false),
@ -120,10 +119,6 @@ class JS_PUBLIC_API ContextOptions {
// Defined out-of-line because it depends on a compile-time option
ContextOptions& setWasmGc(bool flag);
bool wasmMultiValue() const { return wasmMultiValue_; }
// Defined out-of-line because it depends on a compile-time option
ContextOptions& setWasmMultiValue(bool flag);
bool wasmSimd() const { return wasmSimd_; }
// Defined out-of-line because it depends on a compile-time option
ContextOptions& setWasmSimd(bool flag);
@ -266,7 +261,6 @@ class JS_PUBLIC_API ContextOptions {
bool wasmReftypes_ : 1;
bool wasmFunctionReferences_ : 1;
bool wasmGc_ : 1;
bool wasmMultiValue_ : 1;
bool wasmSimd_ : 1;
bool wasmSimdWormhole_ : 1;
bool wasmExceptions_ : 1;

View File

@ -855,12 +855,6 @@ static bool WasmExceptionsEnabled(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
static bool WasmMultiValueEnabled(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(wasm::MultiValuesAvailable(cx));
return true;
}
static bool WasmSimdEnabled(JSContext* cx, unsigned argc, Value* vp) {
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(wasm::SimdAvailable(cx));
@ -6953,10 +6947,6 @@ gc::ZealModeHelpText),
"wasmGcEnabled()",
" Returns a boolean indicating whether the WebAssembly GC types proposal is enabled."),
JS_FN_HELP("wasmMultiValueEnabled", WasmMultiValueEnabled, 1, 0,
"wasmMultiValueEnabled()",
" Returns a boolean indicating whether the WebAssembly multi-value proposal is enabled."),
JS_FN_HELP("wasmExceptionsEnabled", WasmExceptionsEnabled, 1, 0,
"wasmExceptionsEnabled()",
" Returns a boolean indicating whether the WebAssembly exceptions proposal is enabled."),

View File

@ -220,12 +220,8 @@ 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)|(unknown 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.
assertEq(WebAssembly.validate(multiValueModule), true);
} else {
assertErrorMessage(() => wasmEval(multiValueModule), CompileError, /(invalid .*block type)|(unknown type)/);
}
// In this test module, 0 denotes a void-to-void block type.
assertEq(WebAssembly.validate(multiValueModule), true);
// Ensure all invalid opcodes rejected
for (let op of undefinedOpcodes) {

View File

@ -57,7 +57,6 @@ for (let [name, enabled, test] of releasedFeaturesMaybeDisabledAnyway) {
}
let releasedFeatures = [
['multi-value', wasmMultiValueEnabled(), `(module (func (result i32 i32) i32.const 0 i32.const 0))`],
['threads', wasmThreadsEnabled(), `(module (memory 1 1 shared))`],
['reference-types', wasmReftypesEnabled(), `(module (func (param externref)))`],
];

View File

@ -1 +1 @@
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); include:wasm.js; skip-if: !wasmMultiValueEnabled()
|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); include:wasm.js

View File

@ -446,13 +446,6 @@ JS::ContextOptions& JS::ContextOptions::setWasmGc(bool flag) {
return *this;
}
JS::ContextOptions& JS::ContextOptions::setWasmMultiValue(bool flag) {
#ifdef ENABLE_WASM_MULTI_VALUE
wasmMultiValue_ = flag;
#endif
return *this;
}
JS::ContextOptions& JS::ContextOptions::setWasmSimd(bool flag) {
#ifdef ENABLE_WASM_SIMD
wasmSimd_ = flag;

View File

@ -602,9 +602,6 @@ bool shell::enableWasmFunctionReferences = false;
#ifdef ENABLE_WASM_GC
bool shell::enableWasmGc = false;
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
bool shell::enableWasmMultiValue = true;
#endif
#ifdef ENABLE_WASM_SIMD
bool shell::enableWasmSimd = true;
#endif
@ -10926,9 +10923,6 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
#ifdef ENABLE_WASM_GC
enableWasmGc = op.getBoolOption("wasm-gc");
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
enableWasmMultiValue = !op.getBoolOption("no-wasm-multi-value");
#endif
#ifdef ENABLE_WASM_SIMD
enableWasmSimd = !op.getBoolOption("no-wasm-simd");
#endif
@ -10999,9 +10993,6 @@ static bool SetContextOptions(JSContext* cx, const OptionParser& op) {
#ifdef ENABLE_WASM_GC
.setWasmGc(enableWasmGc)
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
.setWasmMultiValue(enableWasmMultiValue)
#endif
#ifdef ENABLE_WASM_SIMD
.setWasmSimd(enableWasmSimd)
#endif
@ -11403,9 +11394,6 @@ static void SetWorkerContextOptions(JSContext* cx) {
#ifdef ENABLE_WASM_GC
.setWasmGc(enableWasmGc)
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
.setWasmMultiValue(enableWasmMultiValue)
#endif
#ifdef ENABLE_WASM_SIMD
.setWasmSimd(enableWasmSimd)
#endif
@ -11925,12 +11913,6 @@ int main(int argc, char** argv, char** envp) {
#else
!op.addBoolOption('\0', "wasm-gc", "No-op") ||
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
!op.addBoolOption('\0', "no-wasm-multi-value",
"Disable wasm multi-value features") ||
#else
!op.addBoolOption('\0', "no-wasm-multi-value", "No-op") ||
#endif
#ifdef ENABLE_WASM_SIMD
!op.addBoolOption('\0', "no-wasm-simd",
"Disable experimental wasm SIMD features") ||
@ -12564,7 +12546,6 @@ int main(int argc, char** argv, char** envp) {
// Feature selection options
"--wasm-gc", "--wasm-simd-wormhole", "--wasm-exceptions",
"--wasm-function-references", "--no-wasm-simd", "--no-wasm-reftypes",
"--no-wasm-multi-value",
// Compiler selection options
"--test-wasm-await-tier2",
#ifdef JS_CODEGEN_ARM64

View File

@ -89,7 +89,6 @@ FeatureArgs FeatureArgs::build(JSContext* cx, const FeatureOptions& options) {
features.refTypes = wasm::ReftypesAvailable(cx);
features.functionReferences = wasm::FunctionReferencesAvailable(cx);
features.gcTypes = wasm::GcTypesAvailable(cx);
features.multiValue = wasm::MultiValuesAvailable(cx);
features.v128 = wasm::SimdAvailable(cx) || wormholeOverride;
features.hugeMemory = wasm::IsHugeMemoryEnabled();
features.simdWormhole = wormholeOverride;

View File

@ -1021,8 +1021,6 @@ static const unsigned MaxTableLimitField = UINT32_MAX;
static const unsigned MaxTableLength = 10000000;
static const unsigned MaxLocals = 50000;
static const unsigned MaxParams = 1000;
// The actual maximum results may be `1` if multi-value is not enabled. Check
// `env->funcMaxResults()` to get the correct value for a module.
static const unsigned MaxResults = 1000;
static const unsigned MaxStructFields = 1000;
static const unsigned MaxMemory32LimitField = 65536;

View File

@ -94,14 +94,6 @@ static inline bool IsFuzzingCranelift(JSContext* cx) {
// These functions read flags and apply fuzzing intercession policies. Never go
// directly to the flags in code below, always go via these accessors.
static inline bool WasmMultiValueFlag(JSContext* cx) {
#ifdef ENABLE_WASM_MULTI_VALUE
return cx->options().wasmMultiValue();
#else
return false;
#endif
}
static inline bool WasmSimdFlag(JSContext* cx) {
#ifdef ENABLE_WASM_SIMD
if (IsFuzzingCranelift(cx)) {
@ -392,10 +384,6 @@ bool wasm::GcTypesAvailable(JSContext* cx) {
return WasmGcFlag(cx) && BaselineAvailable(cx);
}
bool wasm::MultiValuesAvailable(JSContext* cx) {
return WasmMultiValueFlag(cx) && AnyCompilerAvailable(cx);
}
bool wasm::SimdAvailable(JSContext* cx) {
return WasmSimdFlag(cx) &&
(BaselineAvailable(cx) || IonAvailable(cx) || CraneliftAvailable(cx));
@ -435,9 +423,7 @@ bool wasm::ThreadsAvailable(JSContext* cx) {
bool wasm::ExceptionsAvailable(JSContext* cx) {
// Ion & Cranelift do not support Exceptions (for now).
// Exceptions require multi-value.
return WasmExceptionsFlag(cx) && MultiValuesAvailable(cx) &&
BaselineAvailable(cx);
return WasmExceptionsFlag(cx) && BaselineAvailable(cx);
}
bool wasm::HasPlatformSupport(JSContext* cx) {

View File

@ -140,9 +140,6 @@ bool FunctionReferencesAvailable(JSContext* cx);
// Experimental (ref T) types and structure types.
bool GcTypesAvailable(JSContext* cx);
// Multi-value block and function returns.
bool MultiValuesAvailable(JSContext* cx);
// Shared memory and atomics.
bool ThreadsAvailable(JSContext* cx);

View File

@ -1067,11 +1067,6 @@ inline bool OpIter<Policy>::readBlockType(BlockType* type) {
return true;
}
#ifdef ENABLE_WASM_MULTI_VALUE
if (!env_.multiValueEnabled()) {
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");
@ -1084,9 +1079,6 @@ inline bool OpIter<Policy>::readBlockType(BlockType* type) {
*type = BlockType::Func(env_.types.funcType(x));
return true;
#else
return fail("invalid block type reference");
#endif
}
template <typename Policy>

View File

@ -1272,7 +1272,6 @@ struct FeatureArgs {
refTypes(false),
functionReferences(false),
gcTypes(false),
multiValue(false),
v128(false),
hugeMemory(false),
simdWormhole(false),
@ -1293,7 +1292,6 @@ struct FeatureArgs {
bool refTypes;
bool functionReferences;
bool gcTypes;
bool multiValue;
bool v128;
bool hugeMemory;
bool simdWormhole;
@ -1851,17 +1849,13 @@ class ResultType {
enum Kind {
EmptyKind = Tagged::ImmediateKind1,
SingleKind = Tagged::ImmediateKind2,
#ifdef ENABLE_WASM_MULTI_VALUE
VectorKind = Tagged::PointerKind1,
#endif
InvalidKind = Tagged::PointerKind2,
};
ResultType(Kind kind, uint32_t imm) : tagged_(Tagged::Kind(kind), imm) {}
#ifdef ENABLE_WASM_MULTI_VALUE
explicit ResultType(const ValTypeVector* ptr)
: tagged_(Tagged::Kind(VectorKind), ptr) {}
#endif
Kind kind() const { return Kind(tagged_.kind()); }
@ -1870,12 +1864,10 @@ class ResultType {
return ValType(PackedTypeCode::fromBits(tagged_.immediate()));
}
#ifdef ENABLE_WASM_MULTI_VALUE
const ValTypeVector& values() const {
MOZ_ASSERT(kind() == VectorKind);
return *tagged_.pointer();
}
#endif
public:
ResultType() : tagged_(Tagged::Kind(InvalidKind), nullptr) {}
@ -1891,11 +1883,7 @@ class ResultType {
case 1:
return Single(vals[0]);
default:
#ifdef ENABLE_WASM_MULTI_VALUE
return ResultType(&vals);
#else
MOZ_CRASH("multi-value returns not supported");
#endif
}
}
@ -1906,10 +1894,8 @@ class ResultType {
return true;
case SingleKind:
return out->append(singleValType());
#ifdef ENABLE_WASM_MULTI_VALUE
case VectorKind:
return out->appendAll(values());
#endif
default:
MOZ_CRASH("bad resulttype");
}
@ -1923,10 +1909,8 @@ class ResultType {
return 0;
case SingleKind:
return 1;
#ifdef ENABLE_WASM_MULTI_VALUE
case VectorKind:
return values().length();
#endif
default:
MOZ_CRASH("bad resulttype");
}
@ -1937,10 +1921,8 @@ class ResultType {
case SingleKind:
MOZ_ASSERT(i == 0);
return singleValType();
#ifdef ENABLE_WASM_MULTI_VALUE
case VectorKind:
return values()[i];
#endif
default:
MOZ_CRASH("bad resulttype");
}
@ -1952,14 +1934,12 @@ class ResultType {
case SingleKind:
case InvalidKind:
return tagged_.bits() == rhs.tagged_.bits();
#ifdef ENABLE_WASM_MULTI_VALUE
case VectorKind: {
if (rhs.kind() != VectorKind) {
return false;
}
return EqualContainers(values(), rhs.values());
}
#endif
default:
MOZ_CRASH("bad resulttype");
}
@ -1982,17 +1962,13 @@ class BlockType {
enum Kind {
VoidToVoidKind = Tagged::ImmediateKind1,
VoidToSingleKind = Tagged::ImmediateKind2,
#ifdef ENABLE_WASM_MULTI_VALUE
FuncKind = Tagged::PointerKind1,
FuncResultsKind = Tagged::PointerKind2
#endif
};
BlockType(Kind kind, uint32_t imm) : tagged_(Tagged::Kind(kind), imm) {}
#ifdef ENABLE_WASM_MULTI_VALUE
BlockType(Kind kind, const FuncType& type)
: tagged_(Tagged::Kind(kind), &type) {}
#endif
Kind kind() const { return Kind(tagged_.kind()); }
ValType singleValType() const {
@ -2000,9 +1976,7 @@ class BlockType {
return ValType(PackedTypeCode::fromBits(tagged_.immediate()));
}
#ifdef ENABLE_WASM_MULTI_VALUE
const FuncType& funcType() const { return *tagged_.pointer(); }
#endif
public:
BlockType()
@ -2016,15 +1990,10 @@ class BlockType {
return BlockType(VoidToSingleKind, vt.bitsUnsafe());
}
static BlockType Func(const FuncType& type) {
#ifdef ENABLE_WASM_MULTI_VALUE
if (type.args().length() == 0) {
return FuncResults(type);
}
return BlockType(FuncKind, type);
#else
MOZ_ASSERT(type.args().length() == 0);
return FuncResults(type);
#endif
}
static BlockType FuncResults(const FuncType& type) {
switch (type.results().length()) {
@ -2033,11 +2002,7 @@ class BlockType {
case 1:
return VoidToSingle(type.results()[0]);
default:
#ifdef ENABLE_WASM_MULTI_VALUE
return BlockType(FuncResultsKind, type);
#else
MOZ_CRASH("multi-value returns not supported");
#endif
}
}
@ -2045,14 +2010,10 @@ class BlockType {
switch (kind()) {
case VoidToVoidKind:
case VoidToSingleKind:
#ifdef ENABLE_WASM_MULTI_VALUE
case FuncResultsKind:
#endif
return ResultType::Empty();
#ifdef ENABLE_WASM_MULTI_VALUE
case FuncKind:
return ResultType::Vector(funcType().args());
#endif
default:
MOZ_CRASH("unexpected kind");
}
@ -2064,11 +2025,9 @@ class BlockType {
return ResultType::Empty();
case VoidToSingleKind:
return ResultType::Single(singleValType());
#ifdef ENABLE_WASM_MULTI_VALUE
case FuncKind:
case FuncResultsKind:
return ResultType::Vector(funcType().results());
#endif
default:
MOZ_CRASH("unexpected kind");
}
@ -2082,12 +2041,10 @@ class BlockType {
case VoidToVoidKind:
case VoidToSingleKind:
return tagged_.bits() == rhs.tagged_.bits();
#ifdef ENABLE_WASM_MULTI_VALUE
case FuncKind:
return funcType() == rhs.funcType();
case FuncResultsKind:
return EqualContainers(funcType().results(), rhs.funcType().results());
#endif
default:
MOZ_CRASH("unexpected kind");
}

View File

@ -1836,7 +1836,7 @@ static bool DecodeFuncType(Decoder& d, ModuleEnvironment* env,
if (!d.readVarU32(&numResults)) {
return d.fail("bad number of function returns");
}
if (numResults > env->funcMaxResults()) {
if (numResults > MaxResults) {
return d.fail("too many returns in signature");
}
ValTypeVector results;

View File

@ -181,7 +181,6 @@ struct ModuleEnvironment {
bool refTypesEnabled() const { return features.refTypes; }
bool functionReferencesEnabled() const { return features.functionReferences; }
bool gcTypesEnabled() const { return features.gcTypes; }
bool multiValueEnabled() const { return features.multiValue; }
bool v128Enabled() const { return features.v128; }
bool simdWormholeEnabled() const { return features.simdWormhole; }
bool hugeMemoryEnabled() const { return !isAsmJS() && features.hugeMemory; }
@ -190,9 +189,6 @@ struct ModuleEnvironment {
bool usesSharedMemory() const { return memoryUsage == MemoryUsage::Shared; }
bool isAsmJS() const { return kind == ModuleKind::AsmJS; }
uint32_t funcMaxResults() const {
return multiValueEnabled() ? MaxResults : 1;
}
bool funcIsImport(uint32_t funcIndex) const {
return funcIndex < funcImportGlobalDataOffsets.length();
}

View File

@ -928,10 +928,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
#ifdef ENABLE_WASM_GC
bool useWasmGc = Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_gc");
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
bool useWasmMultiValue =
Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_multi_value");
#endif
#ifdef ENABLE_WASM_SIMD
bool useWasmSimd = Preferences::GetBool(JS_OPTIONS_DOT_STR "wasm_simd");
#endif
@ -1025,9 +1021,6 @@ static void ReloadPrefsCallback(const char* pref, void* aXpccx) {
#ifdef ENABLE_WASM_GC
.setWasmGc(useWasmGc)
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
.setWasmMultiValue(useWasmMultiValue)
#endif
#ifdef ENABLE_WASM_SIMD
.setWasmSimd(useWasmSimd)
#endif

View File

@ -1110,9 +1110,6 @@ pref("javascript.options.wasm_baselinejit", true);
pref("javascript.options.wasm_reftypes", true);
pref("javascript.options.wasm_gc", false);
#endif
#ifdef ENABLE_WASM_MULTI_VALUE
pref("javascript.options.wasm_multi_value", true);
#endif
pref("javascript.options.parallel_parsing", true);
pref("javascript.options.source_pragmas", true);