Struct dynasmrt::x64::Assembler [] [src]

pub struct Assembler { /* fields omitted */ }

This struct is an implementation of a dynasm runtime. It supports incremental compilation as well as multithreaded execution with simultaneous compilation. Its implementation ensures that no memory is writeable and executable at the same time.

Methods

impl Assembler
[src]

[src]

Create a new Assembler instance This function will return an error if it was not able to map the required executable memory. However, further methods on the Assembler will simply panic if an error occurs during memory remapping as otherwise it would violate the invariants of the assembler. This behaviour could be improved but currently the underlying memmap crate does not return the original mappings if a call to mprotect/VirtualProtect fails so there is no reliable way to error out if a call fails while leaving the logic of the Assembler intact.

[src]

Create a new dynamic label that can be referenced and defined.

[src]

To allow already committed code to be altered, this method allows modification of the internal ExecutableBuffer directly. When this method is called, all data will be committed and access to the internal ExecutableBuffer will be locked. The passed function will then be called with an AssemblyModifier as argument. Using this AssemblyModifier changes can be made to the committed code. After this function returns, any labels in these changes will be resolved and the ExecutableBuffer will be unlocked again.

[src]

Similar to Assembler::alter, this method allows modification of the yet to be committed assembing buffer. Note that it is not possible to use labels in this context, and overriding labels will cause corruption when the assembler tries to resolve the labels at commit time.

[src]

Commit the assembled code from a temporary buffer to the executable buffer. This method requires write access to the execution buffer and therefore has to obtain a lock on the datastructure. When this method is called, all labels will be resolved, and the result can no longer be changed.

[src]

Consumes the assembler to return the internal ExecutableBuffer. This method will only fail if an Executor currently holds a lock on the datastructure, in which case it will return itself.

[src]

Creates a read-only reference to the internal ExecutableBuffer that must be locked to access it. Multiple of such read-only locks can be obtained at the same time, but as long as they are alive they will block any self.commit() calls.

Trait Implementations

impl Debug for Assembler
[src]

[src]

Formats the value using the given formatter. Read more

impl DynasmApi for Assembler
[src]

[src]

Report the current offset into the assembling target

[src]

Push a byte into the assembling target

[src]

Push a signed byte into the assembling target

[src]

Push a signed word into the assembling target

[src]

Push a signed doubleword into the assembling target

[src]

Push a signed quadword into the assembling target

[src]

Push an usigned word into the assembling target

[src]

Push an usigned doubleword into the assembling target

[src]

Push an usigned quadword into the assembling target

[src]

This function is called in when a runtime error has to be generated. It panics.

impl DynasmLabelApi for Assembler
[src]

tuple of encoded (offset, size)

[src]

Push nops until the assembling target end is aligned to the given alignment

[src]

Record the definition of a global label

[src]

Record a relocation spot for a reference to a global label

[src]

Record the definition of a dynamic label

[src]

Record a relocation spot for a reference to a dynamic label

[src]

Record the definition of a local label

[src]

Record a relocation spot for a forward reference to a local label

[src]

Record a relocation spot for a backward reference to a local label

[src]

Record a relocation spot to an arbitrary target

impl Extend<u8> for Assembler
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl<'a> Extend<&'a u8> for Assembler
[src]

[src]

Extends a collection with the contents of an iterator. Read more

Auto Trait Implementations

impl Send for Assembler

impl Sync for Assembler