Skip to main content

Slots

Struct Slots 

Source
pub struct Slots { /* private fields */ }
Expand description

Which cell of the frame every local and every spill slot of a function is in.

Implementations§

Source§

impl Slots

Source

pub fn apart(locals: &[Local], widths: &[u32]) -> Self

The frame with nothing sharing anything: a cell of its own for every local and every spill slot, in the order the two lists are in.

This is the layout there was before this pass, and it is what a frame gets when nothing has asked for sharing and what it falls back to on a function with too many slots to pair up cheaply.

Source

pub fn share( func: &Func, reach: &Reach, allocation: &Allocation, locals: &[Local], widths: &[u32], ) -> Self

The frame with everything that can share sharing, worked out from the allocator’s liveness.

reach is what reach said about this function before the allocator ran, widths is how many bytes a slot of each of the allocation’s spill slots takes, and locals is the function’s own objects in the order the lowering recorded them. func is the function the allocator has finished with, which is asked for the shape of its control flow and nothing else: the rewrite took the values away but it left every block and every edge where it was.

Source

pub fn cells(&self) -> &[Cell]

The cells the frame is made of, which is what crate::frame places.

Source

pub fn local(&self, local: usize) -> Option<usize>

Which cell a local is in.

Source

pub fn slot(&self, slot: u32) -> Option<usize>

Which cell a spill slot is in.

Source

pub fn saved(&self) -> usize

How many cells were saved by sharing, which is how many things went in beside something else.

This is a count rather than a number of bytes, because how many bytes it saved is the difference between two frames and a frame is not worked out here.

Trait Implementations§

Source§

impl Clone for Slots

Source§

fn clone(&self) -> Slots

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Slots

Source§

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

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

impl Default for Slots

Source§

fn default() -> Slots

Returns the “default value” for a type. Read more
Source§

impl Eq for Slots

Source§

impl PartialEq for Slots

Source§

fn eq(&self, other: &Slots) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Slots

Auto Trait Implementations§

§

impl Freeze for Slots

§

impl RefUnwindSafe for Slots

§

impl Send for Slots

§

impl Sync for Slots

§

impl Unpin for Slots

§

impl UnsafeUnpin for Slots

§

impl UnwindSafe for Slots

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.