Skip to main content

CompiledKernelProcess

Struct CompiledKernelProcess 

Source
pub struct CompiledKernelProcess {
    pub kernel: ProcessFn,
    pub activation: Box<ActivationRecord>,
    pub resume_pc: u32,
    /* private fields */
}

Fields§

§kernel: ProcessFn§activation: Box<ActivationRecord>§resume_pc: u32

Implementations§

Source§

impl CompiledKernelProcess

Source

pub fn new( kernel: ProcessFn, frame_word_count: u32, sim_handle: SimHandle, ) -> Self

frame_word_count is sv-sim-sim::process::liveness::FrameLayout’s own total word count for this process TEMPLATE (each word 8 bytes, matching every other word-addressed frame convention in this workspace) – 0 for a process with no declared locals at all (the fast-path, suspend-free case), in which case resume() passes a null local pointer, matching sv-sim-codegen::process_lower’s own fast-path lowering, which never dereferences it. sim_handle is this process’s own, permanently-bound SimHandle (see this struct’s own doc comment for why resume() uses it, not its state parameter) – SimHandle(std::ptr::null_mut()) is a legal value here too, and is exactly what every pre-Task-S7 test in this file already passes.

Source

pub fn with_task_fibers(self) -> Self

Runs every resume of the kernel on a fiber (LRM 35.5.3, 35.7): when C code of an import task calls an export task which consumes time, the fiber parks with the kernel’s whole stack, this process becomes the parent of the export task’s process (Suspend::ForkJoin), and the kernel continues where it was once that process is done. Only for a design with a timed export task; any other pays nothing. The children this process forks inherit it.

Source

pub fn with_disable_scopes( self, instance: u32, scopes: Arc<[(u32, String, u32)]>, ) -> Self

Makes this process reachable by a disable <label>; of the other processes of instance (LRM 9.6.2): while it is suspended and will resume at pc, a disable of label resumes it at the exit exit of that block or task activation instead, for each (pc, label, exit).

Source

pub fn with_start_inputs(self, inputs: Vec<i64>) -> Self

The values the process’s first run reads as its assertion inputs.

Source

pub fn with_wait_table(self, wait_table: Arc<[WaitTableEntry]>) -> Self

Installs the program’s multi-term wait table (see WaitTableEntry).

Source

pub fn with_instance_slot_mapping(self) -> Self

Declares sim_handle a real STATE InstanceHandle (what sv-sim run always passes): the template slots a kernel waits on are then mapped to this instance’s own cells. Must not be set for a handle that points at anything else (e.g. a unit test’s mock state).

Source

pub fn with_fork_table(self, fork_table: Arc<[SpawnSpec]>) -> Self

R-run Task 17 (PR-085): a builder-style setter installing this instance’s own fork-child table – see Self::fork_table’s own doc comment. A real caller (e.g. a fork-child minter closure built from sv-sim-codegen’s own emitted table) calls this once, right after Self::new, for every kernel drawn from a compiled program that contains at least one fork/join site (harmless to call for one that does not – the table is simply never consulted).

Source

pub fn with_fork_kernels(self, fork_kernels: Arc<[Option<ForkKernel>]>) -> Self

Installs the program’s fork-branch kernels (see Self::fork_kernels).

Source

pub fn frame_bytes(&self) -> &[u8] ⓘ

Task 7 (PR-116, XC-044): a read-only view of this instance’s own permanent frame bytes, exactly as resume() hands them to the compiled kernel’s local parameter. Needed so a test can prove a declared local that the SV source never reads back (PR-017/PR-018’s “every declared local gets a permanent slot regardless of use,” the one claim no SV-visible read/write can observe on its own) still had its pre-suspend write survive, byte-for-byte, across a real suspend/resume round trip – activation/resume_pc are already pub for the identical reason (direct internal-state inspection by a test, never by production scheduler code).

Trait Implementations§

Source§

impl CompiledProcess for CompiledKernelProcess

Source§

fn mint_fork_child(&self, spec: &SpawnSpec) -> Option<Box<dyn CompiledProcess>>

A fork branch runs in the parent’s own instance (same SimHandle) and shares the program’s fork tables, so a nested fork inside a branch mints its own children the same way.

Source§

fn disable_instance(&self) -> Option<u32>

The instance whose block and task names a disable <label>; run by this process (or a fork branch of it) ends the activities of (LRM 9.6.2); None for a process that has none (hand-written test processes, fork branches).
Source§

fn disable_exit(&self, label: &str) -> Option<u32>

Where this process, suspended, resumes if its activity inside the named block or task activation label is disabled: the block’s (or the call’s) end. None when it is not inside label, or has finished.
Source§

fn owns_disable_scope(&self, label: &str) -> bool

Whether the process has a disable scope label at all, whether or not it is inside it now (or has finished): a disable of that block ends the fork branches it left running (LRM 9.6.2).
Source§

fn redirect_resume(&mut self, pc: u32) -> bool

Makes the process’s next resume continue at pc (Self::disable_exit). Returns whether it was blocked joining the processes it forked (join, join_any, wait fork, wait_order).
Source§

fn resume( &mut self, _state: SimHandle, arg: ResumeArg, ops: &dyn SchedulerOps, ) -> Suspend

Source§

impl Send for CompiledKernelProcess

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V