Struct ckb_vm::memory::sparse::SparseMemory

source ·
pub struct SparseMemory<R> { /* private fields */ }
Expand description

A sparse flat memory implementation, it allocates pages only when requested, but besides that, it does not permission checking.

Trait Implementations§

source§

impl<R: Register> Memory for SparseMemory<R>

§

type REG = R

source§

fn new() -> Self

source§

fn new_with_memory(memory_size: usize) -> Self

source§

fn init_pages( &mut self, addr: u64, size: u64, _flags: u8, source: Option<Bytes>, offset_from_addr: u64, ) -> Result<(), Error>

source§

fn fetch_flag(&mut self, page: u64) -> Result<u8, Error>

source§

fn set_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>

source§

fn clear_flag(&mut self, page: u64, flag: u8) -> Result<(), Error>

source§

fn memory_size(&self) -> usize

source§

fn load8(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source§

fn load16(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source§

fn load32(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source§

fn load64(&mut self, addr: &Self::REG) -> Result<Self::REG, Error>

source§

fn execute_load16(&mut self, addr: u64) -> Result<u16, Error>

source§

fn execute_load32(&mut self, addr: u64) -> Result<u32, Error>

source§

fn store_bytes(&mut self, addr: u64, value: &[u8]) -> Result<(), Error>

source§

fn store_byte(&mut self, addr: u64, size: u64, value: u8) -> Result<(), Error>

source§

fn load_bytes(&mut self, addr: u64, size: u64) -> Result<Bytes, Error>

source§

fn store8(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source§

fn store16(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source§

fn store32(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source§

fn store64(&mut self, addr: &Self::REG, value: &Self::REG) -> Result<(), Error>

source§

fn lr(&self) -> &Self::REG

source§

fn set_lr(&mut self, value: &Self::REG)

source§

fn memory_pages(&self) -> usize

Auto Trait Implementations§

§

impl<R> Freeze for SparseMemory<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for SparseMemory<R>
where R: RefUnwindSafe,

§

impl<R> Send for SparseMemory<R>
where R: Send,

§

impl<R> Sync for SparseMemory<R>
where R: Sync,

§

impl<R> Unpin for SparseMemory<R>
where R: Unpin,

§

impl<R> UnwindSafe for SparseMemory<R>
where R: UnwindSafe,

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> 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>,

§

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>,

§

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.