pub struct CompiledKernelProcess {
pub kernel: ProcessFn,
pub activation: Box<ActivationRecord>,
pub resume_pc: u32,
/* private fields */
}Fields§
§kernel: ProcessFn§activation: Box<ActivationRecord>§resume_pc: u32Implementations§
Source§impl CompiledKernelProcess
impl CompiledKernelProcess
Sourcepub fn new(
kernel: ProcessFn,
frame_word_count: u32,
sim_handle: SimHandle,
) -> Self
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.
Sourcepub fn with_task_fibers(self) -> Self
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.
Sourcepub fn with_disable_scopes(
self,
instance: u32,
scopes: Arc<[(u32, String, u32)]>,
) -> Self
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).
Sourcepub fn with_start_inputs(self, inputs: Vec<i64>) -> Self
pub fn with_start_inputs(self, inputs: Vec<i64>) -> Self
The values the process’s first run reads as its assertion inputs.
Sourcepub fn with_wait_table(self, wait_table: Arc<[WaitTableEntry]>) -> Self
pub fn with_wait_table(self, wait_table: Arc<[WaitTableEntry]>) -> Self
Installs the program’s multi-term wait table (see WaitTableEntry).
Sourcepub fn with_instance_slot_mapping(self) -> Self
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).
Sourcepub fn with_fork_table(self, fork_table: Arc<[SpawnSpec]>) -> Self
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).
Sourcepub fn with_fork_kernels(self, fork_kernels: Arc<[Option<ForkKernel>]>) -> Self
pub fn with_fork_kernels(self, fork_kernels: Arc<[Option<ForkKernel>]>) -> Self
Installs the program’s fork-branch kernels (see Self::fork_kernels).
Sourcepub fn frame_bytes(&self) -> &[u8] ⓘ
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
impl CompiledProcess for CompiledKernelProcess
Source§fn mint_fork_child(&self, spec: &SpawnSpec) -> Option<Box<dyn CompiledProcess>>
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>
fn disable_instance(&self) -> Option<u32>
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>
fn disable_exit(&self, label: &str) -> Option<u32>
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
fn owns_disable_scope(&self, label: &str) -> bool
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
fn redirect_resume(&mut self, pc: u32) -> bool
pc
(Self::disable_exit). Returns whether it was blocked joining the
processes it forked (join, join_any, wait fork, wait_order).