Struct wasmer_compiler_singlepass::codegen::FuncGen

source ·
pub struct FuncGen<'a, M: Machine> {
Show 20 fields module: &'a ModuleInfo, config: &'a Singlepass, vmoffsets: &'a VMOffsets, memory_styles: &'a PrimaryMap<MemoryIndex, MemoryStyle>, signature: FunctionType, locals: Vec<Location<M::GPR, M::SIMD>>, local_types: Vec<ValType>, value_stack: Vec<Location<M::GPR, M::SIMD>>, fp_stack: Vec<FloatValue>, control_stack: Vec<ControlFrame>, stack_offset: MachineStackOffset, save_area_offset: Option<MachineStackOffset>, state: MachineState, track_state: bool, machine: M, unreachable_depth: usize, fsm: FunctionStateMap, relocations: Vec<Relocation>, special_labels: SpecialLabelSet, calling_convention: CallingConvention,
}
Expand description

The singlepass per-function code generator.

Fields§

§module: &'a ModuleInfo

Static module information.

§config: &'a Singlepass

ModuleInfo compilation config.

§vmoffsets: &'a VMOffsets

Offsets of vmctx fields.

§memory_styles: &'a PrimaryMap<MemoryIndex, MemoryStyle>§signature: FunctionType

Function signature.

§locals: Vec<Location<M::GPR, M::SIMD>>

Memory locations of local variables.

§local_types: Vec<ValType>

Types of local variables, including arguments.

§value_stack: Vec<Location<M::GPR, M::SIMD>>

Value stack.

§fp_stack: Vec<FloatValue>

Metadata about floating point values on the stack.

§control_stack: Vec<ControlFrame>

A list of frames describing the current control stack.

§stack_offset: MachineStackOffset§save_area_offset: Option<MachineStackOffset>§state: MachineState§track_state: bool§machine: M

Low-level machine state.

§unreachable_depth: usize

Nesting level of unreachable code.

§fsm: FunctionStateMap

Function state map. Not yet used in the reborn version but let’s keep it.

§relocations: Vec<Relocation>

Relocation information.

§special_labels: SpecialLabelSet

A set of special labels for trapping.

§calling_convention: CallingConvention

Calling convention to use.

Implementations§

source§

impl<'a, M: Machine> FuncGen<'a, M>

source

fn get_stack_offset(&self) -> usize

source

fn acquire_locations( &mut self, tys: &[(WpType, MachineValue)], zeroed: bool, ) -> Result<SmallVec<[Location<M::GPR, M::SIMD>; 1]>, CompileError>

Acquires locations from the machine state.

If the returned locations are used for stack value, release_location needs to be called on them; Otherwise, if the returned locations are used for locals, release_location does not need to be called on them.

source

fn release_locations( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>

Releases locations used for stack value.

source

fn release_locations_value( &mut self, stack_depth: usize, ) -> Result<(), CompileError>

Releases locations used for stack value.

source

fn release_locations_only_regs( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>

source

fn release_locations_only_stack( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>

source

fn release_locations_only_osr_state( &mut self, n: usize, ) -> Result<(), CompileError>

source

fn release_locations_keep_state( &mut self, stack_depth: usize, ) -> Result<(), CompileError>

source

fn init_locals( &mut self, n: usize, sig: FunctionType, calling_convention: CallingConvention, ) -> Result<Vec<Location<M::GPR, M::SIMD>>, CompileError>

source

fn finalize_locals( &mut self, calling_convention: CallingConvention, ) -> Result<(), CompileError>

source

pub fn set_srcloc(&mut self, offset: u32)

Set the source location of the Wasm to the given offset.

source

fn get_location_released( &mut self, loc: Location<M::GPR, M::SIMD>, ) -> Result<Location<M::GPR, M::SIMD>, CompileError>

source

fn pop_value_released( &mut self, ) -> Result<Location<M::GPR, M::SIMD>, CompileError>

source

fn i2o1_prepare( &mut self, ty: WpType, ) -> Result<I2O1<M::GPR, M::SIMD>, CompileError>

Prepare data for binary operator with 2 inputs and 1 output.

source

fn mark_trappable(&mut self)

source

fn mark_offset_trappable(&mut self, offset: usize)

source

fn emit_call_native<I: Iterator<Item = Location<M::GPR, M::SIMD>>, J: Iterator<Item = WpType>, F: FnOnce(&mut Self) -> Result<(), CompileError>>( &mut self, cb: F, params: I, params_type: J, ) -> Result<(), CompileError>

Emits a Native ABI call sequence.

The caller MUST NOT hold any temporary registers allocated by acquire_temp_gpr when calling this function.

source

fn _emit_call_native_label<I: Iterator<Item = Location<M::GPR, M::SIMD>>, J: Iterator<Item = WpType>>( &mut self, label: DynamicLabel, params: I, params_type: J, ) -> Result<(), CompileError>

Emits a Native ABI call sequence, specialized for labels as the call target.

source

fn op_memory<F: FnOnce(&mut Self, bool, bool, i32, DynamicLabel, DynamicLabel) -> Result<(), CompileError>>( &mut self, cb: F, ) -> Result<(), CompileError>

Emits a memory operation.

source

pub fn get_state_diff(&mut self) -> usize

source

fn emit_head(&mut self) -> Result<(), CompileError>

source

pub fn new( module: &'a ModuleInfo, config: &'a Singlepass, vmoffsets: &'a VMOffsets, memory_styles: &'a PrimaryMap<MemoryIndex, MemoryStyle>, _table_styles: &'a PrimaryMap<TableIndex, TableStyle>, local_func_index: LocalFunctionIndex, local_types_excluding_arguments: &[WpType], machine: M, calling_convention: CallingConvention, ) -> Result<FuncGen<'a, M>, CompileError>

source

pub fn has_control_frames(&self) -> bool

source

pub fn feed_operator(&mut self, op: Operator<'_>) -> Result<(), CompileError>

source

pub fn finalize( self, data: &FunctionBodyData<'_>, ) -> Result<(CompiledFunction, Option<UnwindFrame>), CompileError>

source

fn sort_call_movs(movs: &mut [(Location<M::GPR, M::SIMD>, M::GPR)])

Auto Trait Implementations§

§

impl<'a, M> Freeze for FuncGen<'a, M>
where M: Freeze,

§

impl<'a, M> !RefUnwindSafe for FuncGen<'a, M>

§

impl<'a, M> Send for FuncGen<'a, M>
where M: Send, <M as Machine>::GPR: Send, <M as Machine>::SIMD: Send,

§

impl<'a, M> Sync for FuncGen<'a, M>
where M: Sync, <M as Machine>::GPR: Sync, <M as Machine>::SIMD: Sync,

§

impl<'a, M> Unpin for FuncGen<'a, M>
where M: Unpin, <M as Machine>::GPR: Unpin, <M as Machine>::SIMD: Unpin,

§

impl<'a, M> !UnwindSafe for FuncGen<'a, M>

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
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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.
§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn