(
engine: &'a Engine,
types: &'a wasmtime_environ::component::ComponentTypesBuilder,
component: &'a wasmtime_environ::component::ComponentTranslation,
module_translatio
| 317 | /// Create a `CompileInputs` for a component. |
| 318 | #[cfg(feature = "component-model")] |
| 319 | fn for_component( |
| 320 | engine: &'a Engine, |
| 321 | types: &'a wasmtime_environ::component::ComponentTypesBuilder, |
| 322 | component: &'a wasmtime_environ::component::ComponentTranslation, |
| 323 | module_translations: impl IntoIterator< |
| 324 | Item = ( |
| 325 | StaticModuleIndex, |
| 326 | &'a ModuleTranslation<'a>, |
| 327 | PrimaryMap<DefinedFuncIndex, FunctionBodyData<'a>>, |
| 328 | ), |
| 329 | >, |
| 330 | ) -> Self { |
| 331 | use wasmtime_environ::Abi; |
| 332 | use wasmtime_environ::component::UnsafeIntrinsic; |
| 333 | |
| 334 | let mut ret = CompileInputs { inputs: vec![] }; |
| 335 | |
| 336 | ret.collect_inputs_in_translations(types.module_types_builder(), module_translations); |
| 337 | let tunables = engine.tunables(); |
| 338 | |
| 339 | for i in component |
| 340 | .component |
| 341 | .unsafe_intrinsics |
| 342 | .iter() |
| 343 | .enumerate() |
| 344 | .filter_map(|(i, ty)| if ty.is_some() { Some(i) } else { None }) |
| 345 | { |
| 346 | let i = u32::try_from(i).unwrap(); |
| 347 | let intrinsic = UnsafeIntrinsic::from_u32(i); |
| 348 | for abi in [Abi::Wasm, Abi::Array] { |
| 349 | ret.push_input(move |compiler| { |
| 350 | let symbol = format!( |
| 351 | "unsafe-intrinsics-{}-{}", |
| 352 | match abi { |
| 353 | Abi::Wasm => "wasm-call", |
| 354 | Abi::Array => "array-call", |
| 355 | Abi::Patchable => "patchable-call", |
| 356 | }, |
| 357 | intrinsic.name(), |
| 358 | ); |
| 359 | Ok(CompileOutput { |
| 360 | key: FuncKey::UnsafeIntrinsic(abi, intrinsic), |
| 361 | function: compiler |
| 362 | .component_compiler() |
| 363 | .compile_intrinsic(tunables, component, types, intrinsic, abi, &symbol) |
| 364 | .with_context(|| format!("failed to compile `{symbol}`"))?, |
| 365 | symbol, |
| 366 | start_srcloc: FilePos::default(), |
| 367 | translation: None, |
| 368 | func_body: None, |
| 369 | }) |
| 370 | }); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | for (idx, trampoline) in component.trampolines.iter() { |
| 375 | for abi in [Abi::Wasm, Abi::Array] { |
| 376 | ret.push_input(move |compiler| { |
nothing calls this directly
no test coverage detected