@@ -2,32 +2,34 @@ use wasm_smith::Config;
22use wasmparser:: { types:: Types , Validator , WasmFeatures } ;
33
44pub fn parser_features_from_config ( config : & Config ) -> WasmFeatures {
5- WasmFeatures {
6- mutable_global : true ,
7- saturating_float_to_int : config. saturating_float_to_int_enabled ,
8- sign_extension : config. sign_extension_ops_enabled ,
9- reference_types : config. reference_types_enabled ,
10- multi_value : config. multi_value_enabled ,
11- bulk_memory : config. bulk_memory_enabled ,
12- simd : config. simd_enabled ,
13- relaxed_simd : config. relaxed_simd_enabled ,
14- multi_memory : config. max_memories > 1 ,
15- exceptions : config. exceptions_enabled ,
16- memory64 : config. memory64_enabled ,
17- tail_call : config. tail_call_enabled ,
18- function_references : config. gc_enabled ,
19- gc : config. gc_enabled ,
20- custom_page_sizes : config. custom_page_sizes_enabled ,
21-
22- threads : false ,
23- shared_everything_threads : false ,
24- floats : true ,
25- extended_const : false ,
26- component_model : false ,
27- memory_control : false ,
28- component_model_values : false ,
29- component_model_nested_names : false ,
30- }
5+ let mut features = WasmFeatures :: MUTABLE_GLOBAL | WasmFeatures :: FLOATS ;
6+ features. set (
7+ WasmFeatures :: SATURATING_FLOAT_TO_INT ,
8+ config. saturating_float_to_int_enabled ,
9+ ) ;
10+ features. set (
11+ WasmFeatures :: SIGN_EXTENSION ,
12+ config. sign_extension_ops_enabled ,
13+ ) ;
14+ features. set (
15+ WasmFeatures :: REFERENCE_TYPES ,
16+ config. reference_types_enabled ,
17+ ) ;
18+ features. set ( WasmFeatures :: MULTI_VALUE , config. multi_value_enabled ) ;
19+ features. set ( WasmFeatures :: BULK_MEMORY , config. bulk_memory_enabled ) ;
20+ features. set ( WasmFeatures :: SIMD , config. simd_enabled ) ;
21+ features. set ( WasmFeatures :: RELAXED_SIMD , config. relaxed_simd_enabled ) ;
22+ features. set ( WasmFeatures :: MULTI_MEMORY , config. max_memories > 1 ) ;
23+ features. set ( WasmFeatures :: EXCEPTIONS , config. exceptions_enabled ) ;
24+ features. set ( WasmFeatures :: MEMORY64 , config. memory64_enabled ) ;
25+ features. set ( WasmFeatures :: TAIL_CALL , config. tail_call_enabled ) ;
26+ features. set ( WasmFeatures :: FUNCTION_REFERENCES , config. gc_enabled ) ;
27+ features. set ( WasmFeatures :: GC , config. gc_enabled ) ;
28+ features. set (
29+ WasmFeatures :: CUSTOM_PAGE_SIZE ,
30+ config. custom_page_sizes_enabled ,
31+ ) ;
32+ features
3133}
3234
3335pub fn validate ( validator : & mut Validator , bytes : & [ u8 ] ) -> Types {
0 commit comments