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

Method append

cranelift/codegen/src/machinst/buffer.rs:2484–2510  ·  view source on GitHub ↗
(
        &mut self,
        labeled: bool,
        func: &[u8],
        align: u32,
        ctrl_plane: &mut ControlPlane,
    )

Source from the content-addressed store, hash-verified

2482
2483impl<I: VCodeInst> TextSectionBuilder for MachTextSectionBuilder<I> {
2484 fn append(
2485 &mut self,
2486 labeled: bool,
2487 func: &[u8],
2488 align: u32,
2489 ctrl_plane: &mut ControlPlane,
2490 ) -> u64 {
2491 // Conditionally emit an island if it's necessary to resolve jumps
2492 // between functions which are too far away.
2493 let size = func.len() as u32;
2494 if self.force_veneers == ForceVeneers::Yes || self.buf.island_needed(size) {
2495 self.buf
2496 .emit_island_maybe_forced(self.force_veneers, size, ctrl_plane);
2497 }
2498
2499 self.buf.align_to(align);
2500 let pos = self.buf.cur_offset();
2501 if labeled {
2502 self.buf.bind_label(
2503 MachLabel::from_block(BlockIndex::new(self.next_func)),
2504 ctrl_plane,
2505 );
2506 self.next_func += 1;
2507 }
2508 self.buf.put_data(func);
2509 u64::from(pos)
2510 }
2511
2512 fn resolve_reloc(&mut self, offset: u64, reloc: Reloc, addend: Addend, target: usize) -> bool {
2513 crate::trace!(

Callers

nothing calls this directly

Calls 9

fromFunction · 0.85
island_neededMethod · 0.80
cur_offsetMethod · 0.80
bind_labelMethod · 0.80
put_dataMethod · 0.80
newFunction · 0.50
lenMethod · 0.45
align_toMethod · 0.45

Tested by

no test coverage detected