(
&mut self,
id: FuncId,
alignment: u64,
bytes: &[u8],
relocs: &[ModuleReloc],
)
| 530 | } |
| 531 | |
| 532 | fn define_function_bytes( |
| 533 | &mut self, |
| 534 | id: FuncId, |
| 535 | alignment: u64, |
| 536 | bytes: &[u8], |
| 537 | relocs: &[ModuleReloc], |
| 538 | ) -> ModuleResult<()> { |
| 539 | info!("defining function {id} with bytes"); |
| 540 | let decl = self.declarations.get_function_decl(id); |
| 541 | if !decl.linkage.is_definable() { |
| 542 | return Err(ModuleError::InvalidImportDefinition( |
| 543 | decl.linkage_name(id).into_owned(), |
| 544 | )); |
| 545 | } |
| 546 | |
| 547 | if !self.compiled_functions[id].is_none() { |
| 548 | return Err(ModuleError::DuplicateDefinition( |
| 549 | decl.linkage_name(id).into_owned(), |
| 550 | )); |
| 551 | } |
| 552 | |
| 553 | let align = alignment |
| 554 | .max(self.isa.function_alignment().minimum as u64) |
| 555 | .max(self.isa.symbol_alignment()); |
| 556 | |
| 557 | let blob = self.compiled_functions[id].insert(CompiledBlob::new( |
| 558 | &mut *self.memory, |
| 559 | bytes, |
| 560 | align, |
| 561 | relocs.to_owned(), |
| 562 | #[cfg(feature = "wasmtime-unwinder")] |
| 563 | None, |
| 564 | JITMemoryKind::Executable, |
| 565 | )?); |
| 566 | let (ptr, size) = (blob.ptr(), blob.size()); |
| 567 | self.record_function_for_perf(ptr, size, &decl.linkage_name(id)); |
| 568 | |
| 569 | self.functions_to_finalize.push(id); |
| 570 | |
| 571 | Ok(()) |
| 572 | } |
| 573 | |
| 574 | fn define_data(&mut self, id: DataId, data: &DataDescription) -> ModuleResult<()> { |
| 575 | let decl = self.declarations.get_data_decl(id); |
nothing calls this directly
no test coverage detected