[][src]Struct lucet_module::HeapSpec

pub struct HeapSpec {
    pub reserved_size: u64,
    pub guard_size: u64,
    pub initial_size: u64,
    pub max_size: Option<u64>,
}

Specifications about the heap of a Lucet module.

Fields

reserved_size: u64

Total bytes of memory for the heap to possibly expand into, as configured for Cranelift codegen.

All of this memory is addressable. Only some part of it is accessible - from 0 to the initial size, guaranteed, and up to the max_size. This size allows Cranelift to elide checks of the base pointer. At the moment that just means checking if it is greater than 4gb, in which case it can elide the base pointer check completely. In the future, Cranelift could use a solver to elide more base pointer checks if it can prove the calculation will always be less than this bound.

Specified in bytes, and must be evenly divisible by the host page size (4K).

guard_size: u64

Total bytes of memory after the reserved area, as configured for Cranelift codegen.

All of this memory is addressable, but it is never accessible - it is guaranteed to trap if an access happens in this region. This size allows Cranelift to use common subexpression elimination to reduce checks of the sum of base pointer and offset (where the offset is always rounded up to a multiple of the guard size, to be friendly to CSE).

Specified in bytes, and must be evenly divisible by the host page size (4K).

initial_size: u64

Total bytes of memory for the WebAssembly program's linear memory upon initialization.

Specified in bytes, must be evenly divisible by the WebAssembly page size (64K), and must be less than or equal to reserved_size.

max_size: Option<u64>

Maximum bytes of memory for the WebAssembly program's linear memory at any time.

This is not necessarily the same as reserved_size - we want to be able to tune the check bound there separately than the declaration of a max size in the client program.

The program may optionally define this value. If it does, it must be less than the reserved_size. If it does not, the max size is left up to the runtime, and is allowed to be less than reserved_size.

Methods

impl HeapSpec[src]

pub fn new(
    reserved_size: u64,
    guard_size: u64,
    initial_size: u64,
    max_size: Option<u64>
) -> Self
[src]

pub fn empty() -> Self[src]

Some very small test programs dont specify a memory import or definition.

Trait Implementations

impl Clone for HeapSpec[src]

impl Debug for HeapSpec[src]

impl Default for HeapSpec[src]

impl<'de> Deserialize<'de> for HeapSpec[src]

impl Eq for HeapSpec[src]

impl PartialEq<HeapSpec> for HeapSpec[src]

impl Serialize for HeapSpec[src]

impl StructuralEq for HeapSpec[src]

impl StructuralPartialEq for HeapSpec[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.