Struct dynasmrt::Assembler [−][src]
pub struct Assembler<R: Relocation> { /* fields omitted */ }
Expand description
A full assembler implementation. Supports labels, all types of relocations, incremental compilation and multithreaded execution with simultaneous compiltion. Its implementation guarantees no memory is executable and writable at the same time.
Implementations
Create a new, empty assembler, with initial allocation size page_size
.
Create a new dynamic label ID
Use an UncommittedModifier
to alter uncommitted code.
This does not allow the user to change labels/relocations.
Use a Modifier
to alter committed code directly. While this is happening
no code can be executed as the relevant pages are remapped as writable.
This API supports defining new labels/relocations, and overwriting previously defined relocations.
Commit code, flushing the temporary internal assembling buffer to the mapped executable memory. This makes assembled code available for execution.
Finalize this assembler, returning the internal executablebuffer if no Executor instances exist.
This panics if any uncommitted changes caused errors near the end. To handle these, call commit()
explicitly beforehand.
Create an executor which can be used to execute code while still assembling code
Provides access to the assemblers internal labels registry
Provides mutable access to the assemblers internal labels registry
Trait Implementations
Report the current offset into the assembling target
Push filler until the assembling target end is aligned to the given alignment.
This function is called in when a runtime error has to be generated. It panics.
type Relocation = R
type Relocation = R
The relocation info type this assembler uses.
Record the definition of a local label
Record the definition of a global label
Record the definition of a dynamic label
Equivalent of global_reloc, but takes a non-encoded relocation
fn dynamic_relocation(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn dynamic_relocation(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of dynamic_reloc, but takes a non-encoded relocation
Equivalent of forward_reloc, but takes a non-encoded relocation
Equivalent of backward_reloc, but takes a non-encoded relocation
Equivalent of bare_reloc, but takes a non-encoded relocation
fn forward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn forward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a forward reference to a local label
fn backward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn backward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a backward reference to a local label
fn global_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn global_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a reference to a global label
fn dynamic_reloc(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn dynamic_reloc(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a reference to a dynamic label
fn bare_reloc(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn bare_reloc(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot to an arbitrary target.
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more