pub struct ContainerChunk {
pub def: ContainerDef,
pub relocations: Vec<Relocation>,
}Expand description
One container’s codegen output: a ContainerDef whose bytecode still
carries UNRESOLVED_NAME_ID placeholders at every Relocation site,
plus the relocation table itself. link resolves the
symbols and yields a fully-patched ContainerDef.
Fields§
§def: ContainerDefThe container definition. def.bytecode holds placeholders at every
relocation offset until link runs.
relocations: Vec<Relocation>Symbolic name-reference patch sites into def.bytecode, in emission
order.
Implementations§
Source§impl ContainerChunk
impl ContainerChunk
Sourcepub fn link(
self,
resolve: impl Fn(&str) -> Option<NameId>,
) -> Result<ContainerDef, CodegenError>
pub fn link( self, resolve: impl Fn(&str) -> Option<NameId>, ) -> Result<ContainerDef, CodegenError>
Resolve every relocation against resolve and patch the operand
bytes in place, consuming the chunk and returning the linked
ContainerDef.
resolve maps a symbol to its assembled NameId (a lookup into
the story name table). A miss is an internal invariant violation —
the writer interns every referenced symbol into the name table as it
records the relocation — so it surfaces as a distinct
CodegenError rather than being silently skipped.
Trait Implementations§
Source§impl Clone for ContainerChunk
impl Clone for ContainerChunk
Source§fn clone(&self) -> ContainerChunk
fn clone(&self) -> ContainerChunk
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more