Skip to content

Commit 3e0dda0

Browse files
authored
Enable memory64 by default during validation (#1896)
This proposal has now reached phase 4 in the standardization process which is the threshold for enabling it by default in this repository. Fuzzing knobs a have been tuned a bit to take this on-by-default behavior into account.
1 parent 196a6be commit 3e0dda0

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ Currently implemented proposals in this repository that are stage 4+ are:
191191
(note this is not phase 4 but `wast` does not have the concept of features)
192192
* [x] [function-references](https://github.com/WebAssembly/function-references)
193193
* [x] [gc](https://github.com/WebAssembly/gc)
194+
* [x] [memory64](https://github.com/WebAssembly/memory64)
194195
* [x] [multi-memory](https://github.com/WebAssembly/multi-memory)
195196
* [x] [multi-value](https://github.com/WebAssembly/multi-value)
196197
* [x] [mutable-global](https://github.com/WebAssembly/mutable-global)
@@ -211,7 +212,6 @@ changed since these proposals were implemented, so there may be a mismatch too.
211212

212213
* [x] [custom-page-sizes](https://github.com/WebAssembly/custom-page-sizes)
213214
* [x] [memory-control](https://github.com/WebAssembly/memory-control)
214-
* [x] [memory64](https://github.com/WebAssembly/memory64)
215215
* [x] [shared-everything-threads](https://github.com/WebAssembly/shared-everything-threads)
216216
* [x] [stack-switching](https://github.com/WebAssembly/stack-switching)
217217
* [x] [wide-arithmetic](https://github.com/WebAssembly/wide-arithmetic)

crates/wasm-smith/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,10 @@ define_config! {
455455
/// Note that this is irrelevant unless value model support is enabled.
456456
pub max_values: usize = 10,
457457

458-
/// Returns whether 64-bit memories are allowed. Defaults to false.
458+
/// Returns whether 64-bit memories are allowed. Defaults to true.
459459
///
460460
/// Note that this is the gate for the memory64 proposal to WebAssembly.
461-
pub memory64_enabled: bool = false,
461+
pub memory64_enabled: bool = true,
462462

463463
/// Whether every Wasm memory must have a maximum size
464464
/// specified. Defaults to `false`.
@@ -718,6 +718,7 @@ impl<'a> Arbitrary<'a> for Config {
718718
threads_enabled: u.arbitrary()?,
719719
tail_call_enabled: u.arbitrary()?,
720720
gc_enabled: u.arbitrary()?,
721+
memory64_enabled: u.arbitrary()?,
721722
allowed_instructions: {
722723
use flagset::Flags;
723724
let mut allowed = Vec::new();
@@ -764,7 +765,6 @@ impl<'a> Arbitrary<'a> for Config {
764765
allow_invalid_funcs: false,
765766

766767
// Proposals that are not stage4+ are disabled by default.
767-
memory64_enabled: false,
768768
custom_page_sizes_enabled: false,
769769
wide_arithmetic_enabled: false,
770770
shared_everything_threads_enabled: false,

crates/wasm-smith/tests/core.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn smoke_test_module() {
1616
if let Ok(module) = Module::arbitrary_take_rest(u) {
1717
let wasm_bytes = module.to_bytes();
1818

19-
let mut validator = Validator::new_with_features(wasm_features());
19+
let mut validator = Validator::new_with_features(WasmFeatures::all());
2020
validate(&mut validator, &wasm_bytes);
2121
}
2222
}
@@ -33,7 +33,7 @@ fn smoke_test_ensure_termination() {
3333
module.ensure_termination(10).unwrap();
3434
let wasm_bytes = module.to_bytes();
3535

36-
let mut validator = Validator::new_with_features(wasm_features());
36+
let mut validator = Validator::new_with_features(WasmFeatures::all());
3737
validate(&mut validator, &wasm_bytes);
3838
}
3939
}
@@ -50,7 +50,7 @@ fn smoke_test_swarm_config() {
5050
if let Ok(module) = Module::new(config, &mut u) {
5151
let wasm_bytes = module.to_bytes();
5252

53-
let mut validator = Validator::new_with_features(wasm_features());
53+
let mut validator = Validator::new_with_features(WasmFeatures::all());
5454
validate(&mut validator, &wasm_bytes);
5555
}
5656
}
@@ -68,7 +68,7 @@ fn multi_value_disabled() {
6868
cfg.multi_value_enabled = false;
6969
if let Ok(module) = Module::new(cfg, &mut u) {
7070
let wasm_bytes = module.to_bytes();
71-
let mut features = wasm_features();
71+
let mut features = WasmFeatures::all();
7272
features.remove(WasmFeatures::MULTI_VALUE);
7373
let mut validator = Validator::new_with_features(features);
7474
validate(&mut validator, &wasm_bytes);
@@ -96,13 +96,15 @@ fn smoke_can_smith_valid_webassembly_one_point_oh() {
9696
cfg.memory64_enabled = false;
9797
cfg.reference_types_enabled = false;
9898
cfg.gc_enabled = false;
99+
cfg.extended_const_enabled = false;
100+
cfg.tail_call_enabled = false;
101+
cfg.threads_enabled = false;
99102
cfg.max_memories = 1;
100103
cfg.max_tables = 1;
101-
let features = cfg.features();
102104
if let Ok(module) = Module::new(cfg, &mut u) {
103105
let wasm_bytes = module.to_bytes();
104106
// This table should set to `true` only features specified in wasm-core-1 spec.
105-
let mut validator = Validator::new_with_features(features);
107+
let mut validator = Validator::new_with_features(WasmFeatures::WASM1);
106108
validate(&mut validator, &wasm_bytes);
107109
}
108110
}
@@ -119,7 +121,7 @@ fn smoke_test_no_trapping_mode() {
119121
cfg.disallow_traps = true;
120122
if let Ok(module) = Module::new(cfg, &mut u) {
121123
let wasm_bytes = module.to_bytes();
122-
let mut validator = Validator::new_with_features(wasm_features());
124+
let mut validator = Validator::new_with_features(WasmFeatures::all());
123125
validate(&mut validator, &wasm_bytes);
124126
}
125127
}
@@ -136,7 +138,7 @@ fn smoke_test_disallow_floats() {
136138
cfg.allow_floats = false;
137139
if let Ok(module) = Module::new(cfg, &mut u) {
138140
let wasm_bytes = module.to_bytes();
139-
let mut features = wasm_features();
141+
let mut features = WasmFeatures::all();
140142
features.remove(WasmFeatures::FLOATS);
141143
let mut validator = Validator::new_with_features(features);
142144
validate(&mut validator, &wasm_bytes);
@@ -156,7 +158,7 @@ fn smoke_test_reference_types() {
156158
cfg.max_tables = 1;
157159
if let Ok(module) = Module::new(cfg, &mut u) {
158160
let wasm_bytes = module.to_bytes();
159-
let mut features = wasm_features();
161+
let mut features = WasmFeatures::all();
160162
features.remove(WasmFeatures::REFERENCE_TYPES);
161163
let mut validator = Validator::new_with_features(features);
162164
validate(&mut validator, &wasm_bytes);
@@ -178,7 +180,7 @@ fn smoke_test_wasm_gc() {
178180
};
179181
if let Ok(module) = Module::new(config, &mut u) {
180182
let wasm_bytes = module.to_bytes();
181-
let mut validator = Validator::new_with_features(wasm_features());
183+
let mut validator = Validator::new_with_features(WasmFeatures::all());
182184
validate(&mut validator, &wasm_bytes);
183185
}
184186
}
@@ -197,12 +199,8 @@ fn smoke_test_wasm_custom_page_sizes() {
197199
};
198200
if let Ok(module) = Module::new(config, &mut u) {
199201
let wasm_bytes = module.to_bytes();
200-
let mut validator = Validator::new_with_features(wasm_features());
202+
let mut validator = Validator::new_with_features(WasmFeatures::all());
201203
validate(&mut validator, &wasm_bytes);
202204
}
203205
}
204206
}
205-
206-
fn wasm_features() -> WasmFeatures {
207-
WasmFeatures::all()
208-
}

crates/wasmparser/src/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ define_wasm_features! {
179179
/// The WebAssembly exception handling proposal.
180180
pub exceptions: EXCEPTIONS(1 << 13) = true;
181181
/// The WebAssembly memory64 proposal.
182-
pub memory64: MEMORY64(1 << 14) = false;
182+
pub memory64: MEMORY64(1 << 14) = true;
183183
/// The WebAssembly extended_const proposal.
184184
pub extended_const: EXTENDED_CONST(1 << 15) = true;
185185
/// The WebAssembly component model proposal.

fuzz/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn generate_valid_module(
2323

2424
// These are disabled in the swarm config by default, but we want to test
2525
// them. Use the input data to determine whether these features are enabled.
26-
config.memory64_enabled = u.arbitrary()?;
2726
config.canonicalize_nans = u.arbitrary()?;
2827
config.custom_page_sizes_enabled = u.arbitrary()?;
2928
config.wide_arithmetic_enabled = u.arbitrary()?;
@@ -58,7 +57,6 @@ pub fn generate_valid_component(
5857
// them. Use the input data to determine whether these features are enabled.
5958
config.simd_enabled = u.arbitrary()?;
6059
config.relaxed_simd_enabled = config.simd_enabled && u.arbitrary()?;
61-
config.memory64_enabled = u.arbitrary()?;
6260
config.exceptions_enabled = u.arbitrary()?;
6361
config.canonicalize_nans = u.arbitrary()?;
6462

0 commit comments

Comments
 (0)