Sha256: a6dbd1f8b704e39f9252a236f62a89c85e34fac3f4141724a5db536b35d73d68

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

use super::*;
use crate::ir;
use cranelift_control::ControlPlane;

/// State carried between emissions of a sequence of instructions.
#[derive(Default, Clone, Debug)]
pub struct EmitState {
    /// The user stack map for the upcoming instruction, as provided to
    /// `pre_safepoint()`.
    user_stack_map: Option<ir::UserStackMap>,

    /// Only used during fuzz-testing. Otherwise, it is a zero-sized struct and
    /// optimized away at compiletime. See [cranelift_control].
    ctrl_plane: ControlPlane,

    /// A copy of the frame layout, used during the emission of `Inst::ReturnCallKnown` and
    /// `Inst::ReturnCallUnknown` instructions.
    frame_layout: FrameLayout,
}

impl MachInstEmitState<Inst> for EmitState {
    fn new(abi: &Callee<X64ABIMachineSpec>, ctrl_plane: ControlPlane) -> Self {
        EmitState {
            user_stack_map: None,
            ctrl_plane,
            frame_layout: abi.frame_layout().clone(),
        }
    }

    fn pre_safepoint(&mut self, user_stack_map: Option<ir::UserStackMap>) {
        self.user_stack_map = user_stack_map;
    }

    fn ctrl_plane_mut(&mut self) -> &mut ControlPlane {
        &mut self.ctrl_plane
    }

    fn take_ctrl_plane(self) -> ControlPlane {
        self.ctrl_plane
    }

    fn frame_layout(&self) -> &FrameLayout {
        &self.frame_layout
    }
}

impl EmitState {
    pub(crate) fn take_stack_map(&mut self) -> Option<ir::UserStackMap> {
        self.user_stack_map.take()
    }

    pub(crate) fn clear_post_insn(&mut self) {
        self.user_stack_map = None;
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/cranelift-codegen-0.116.0/src/isa/x64/inst/emit_state.rs
wasmtime-28.0.0 ./ext/cargo-vendor/cranelift-codegen-0.115.0/src/isa/x64/inst/emit_state.rs
wasmtime-27.0.0 ./ext/cargo-vendor/cranelift-codegen-0.114.0/src/isa/x64/inst/emit_state.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cranelift-codegen-0.113.0/src/isa/x64/inst/emit_state.rs
wasmtime-25.0.2 ./ext/cargo-vendor/cranelift-codegen-0.112.2/src/isa/x64/inst/emit_state.rs
wasmtime-25.0.1 ./ext/cargo-vendor/cranelift-codegen-0.112.1/src/isa/x64/inst/emit_state.rs
wasmtime-25.0.0 ./ext/cargo-vendor/cranelift-codegen-0.112.0/src/isa/x64/inst/emit_state.rs