instr_noalloc_t

Struct instr_noalloc_t 

Source
#[repr(C)]
pub struct instr_noalloc_t { pub instr: instr_t, pub srcs: [opnd_t; 7], pub dsts: [opnd_t; 8], pub encode_buf: [byte; 17], }
Expand description

A version of #instr_t which guarantees to not use heap allocation for regular decoding and encoding. It inlines all the possible operands and encoding space inside the structure. Some operations could still use heap if custom label data is used to point at heap-allocated structures through extension libraries or custom code.

The instr_from_noalloc() function should be used to obtain an #instr_t pointer for passing to API functions:

\code instr_noalloc_t noalloc; instr_noalloc_init(dcontext, &noalloc); instr_t *instr = instr_from_noalloc(&noalloc); pc = decode(dcontext, ptr, instr); \endcode

No freeing is required. To re-use the same structure, instr_reset() can be called.

Some operations are not supported on this instruction format:

  • instr_clone()
  • instr_remove_srcs()
  • instr_remove_dsts()
  • Automated re-relativization when encoding.

This format does not support caching encodings, so it is less efficient for encoding. It is intended for use when decoding in a signal handler or other locations where heap allocation is unsafe.

Fields§

§instr: instr_t

< The base instruction, valid for passing to API functions.

§srcs: [opnd_t; 7]

< Built-in storage for source operands.

§dsts: [opnd_t; 8]

< Built-in storage for destination operands.

§encode_buf: [byte; 17]

< Encoding space for instr_length(), etc.

Trait Implementations§

Source§

impl Clone for instr_noalloc_t

Source§

fn clone(&self) -> instr_noalloc_t

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for instr_noalloc_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for instr_noalloc_t

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.