MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / enable_wasm_features

Method enable_wasm_features

crates/cli-flags/src/lib.rs:1174–1256  ·  view source on GitHub ↗
(&self, config: &mut Config)

Source from the content-addressed store, hash-verified

1172 }
1173
1174 pub fn enable_wasm_features(&self, config: &mut Config) -> Result<()> {
1175 let all = self.wasm.all_proposals;
1176
1177 if let Some(enable) = self.wasm.simd.or(all) {
1178 config.wasm_simd(enable);
1179 }
1180 if let Some(enable) = self.wasm.relaxed_simd.or(all) {
1181 config.wasm_relaxed_simd(enable);
1182 }
1183 if let Some(enable) = self.wasm.bulk_memory.or(all) {
1184 config.wasm_bulk_memory(enable);
1185 }
1186 if let Some(enable) = self.wasm.multi_value.or(all) {
1187 config.wasm_multi_value(enable);
1188 }
1189 if let Some(enable) = self.wasm.tail_call.or(all) {
1190 config.wasm_tail_call(enable);
1191 }
1192 if let Some(enable) = self.wasm.multi_memory.or(all) {
1193 config.wasm_multi_memory(enable);
1194 }
1195 if let Some(enable) = self.wasm.memory64.or(all) {
1196 config.wasm_memory64(enable);
1197 }
1198 if let Some(enable) = self.wasm.stack_switching {
1199 config.wasm_stack_switching(enable);
1200 }
1201 if let Some(enable) = self.wasm.custom_page_sizes.or(all) {
1202 config.wasm_custom_page_sizes(enable);
1203 }
1204 if let Some(enable) = self.wasm.wide_arithmetic.or(all) {
1205 config.wasm_wide_arithmetic(enable);
1206 }
1207 // Not included in `all_proposals`: off by default until fuzzed.
1208 if let Some(enable) = self.wasm.branch_hinting {
1209 config.wasm_branch_hinting(enable);
1210 }
1211 if let Some(enable) = self.wasm.extended_const.or(all) {
1212 config.wasm_extended_const(enable);
1213 }
1214
1215 macro_rules! handle_conditionally_compiled {
1216 ($(($feature:tt, $field:tt, $method:tt))*) => ($(
1217 if let Some(enable) = self.wasm.$field.or(all) {
1218 #[cfg(feature = $feature)]
1219 config.$method(enable);
1220 #[cfg(not(feature = $feature))]
1221 if enable && all.is_none() {
1222 bail!("support for {} was disabled at compile-time", $feature);
1223 }
1224 }
1225 )*)
1226 }
1227
1228 handle_conditionally_compiled! {
1229 ("component-model", component_model, wasm_component_model)
1230 ("component-model-async", component_model_async, wasm_component_model_async)
1231 ("component-model-async", component_model_more_async_builtins, wasm_component_model_more_async_builtins)

Callers 1

configMethod · 0.80

Calls 15

OkFunction · 0.85
wasm_stack_switchingMethod · 0.80
wasm_branch_hintingMethod · 0.80
wasm_extended_constMethod · 0.80
orMethod · 0.45
wasm_simdMethod · 0.45
wasm_relaxed_simdMethod · 0.45
wasm_bulk_memoryMethod · 0.45
wasm_multi_valueMethod · 0.45
wasm_tail_callMethod · 0.45
wasm_multi_memoryMethod · 0.45

Tested by

no test coverage detected