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>
impl<'a, M: Machine> FuncGen<'a, M>
fn get_stack_offset(&self) -> usize
sourcefn acquire_locations(
&mut self,
tys: &[(WpType, MachineValue)],
zeroed: bool,
) -> Result<SmallVec<[Location<M::GPR, M::SIMD>; 1]>, CompileError>
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.
sourcefn release_locations(
&mut self,
locs: &[Location<M::GPR, M::SIMD>],
) -> Result<(), CompileError>
fn release_locations( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>
Releases locations used for stack value.
sourcefn release_locations_value(
&mut self,
stack_depth: usize,
) -> Result<(), CompileError>
fn release_locations_value( &mut self, stack_depth: usize, ) -> Result<(), CompileError>
Releases locations used for stack value.
fn release_locations_only_regs( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>
fn release_locations_only_stack( &mut self, locs: &[Location<M::GPR, M::SIMD>], ) -> Result<(), CompileError>
fn release_locations_only_osr_state( &mut self, n: usize, ) -> Result<(), CompileError>
fn release_locations_keep_state( &mut self, stack_depth: usize, ) -> Result<(), CompileError>
fn init_locals( &mut self, n: usize, sig: FunctionType, calling_convention: CallingConvention, ) -> Result<Vec<Location<M::GPR, M::SIMD>>, CompileError>
fn finalize_locals( &mut self, calling_convention: CallingConvention, ) -> Result<(), CompileError>
sourcepub fn set_srcloc(&mut self, offset: u32)
pub fn set_srcloc(&mut self, offset: u32)
Set the source location of the Wasm to the given offset.
fn get_location_released( &mut self, loc: Location<M::GPR, M::SIMD>, ) -> Result<Location<M::GPR, M::SIMD>, CompileError>
fn pop_value_released( &mut self, ) -> Result<Location<M::GPR, M::SIMD>, CompileError>
sourcefn i2o1_prepare(
&mut self,
ty: WpType,
) -> Result<I2O1<M::GPR, M::SIMD>, CompileError>
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.
fn mark_trappable(&mut self)
fn mark_offset_trappable(&mut self, offset: usize)
sourcefn 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>
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.
sourcefn _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>
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.
sourcefn op_memory<F: FnOnce(&mut Self, bool, bool, i32, DynamicLabel, DynamicLabel) -> Result<(), CompileError>>(
&mut self,
cb: F,
) -> Result<(), CompileError>
fn op_memory<F: FnOnce(&mut Self, bool, bool, i32, DynamicLabel, DynamicLabel) -> Result<(), CompileError>>( &mut self, cb: F, ) -> Result<(), CompileError>
Emits a memory operation.
pub fn get_state_diff(&mut self) -> usize
fn emit_head(&mut self) -> Result<(), CompileError>
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>
pub fn has_control_frames(&self) -> bool
pub fn feed_operator(&mut self, op: Operator<'_>) -> Result<(), CompileError>
pub fn finalize( self, data: &FunctionBodyData<'_>, ) -> Result<(CompiledFunction, Option<UnwindFrame>), CompileError>
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>
impl<'a, M> Sync for FuncGen<'a, M>
impl<'a, M> Unpin for FuncGen<'a, M>
impl<'a, M> !UnwindSafe for FuncGen<'a, M>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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