pub trait CompiledProcess: Send {
// Required method
fn resume(
&mut self,
state: SimHandle,
arg: ResumeArg,
ops: &dyn SchedulerOps,
) -> Suspend;
// Provided methods
fn mint_fork_child(
&self,
_spec: &SpawnSpec,
) -> Option<Box<dyn CompiledProcess>> { ... }
fn disable_instance(&self) -> Option<u32> { ... }
fn disable_exit(&self, _label: &str) -> Option<u32> { ... }
fn owns_disable_scope(&self, _label: &str) -> bool { ... }
fn redirect_resume(&mut self, _pc: u32) -> bool { ... }
}Expand description
One resumable process (scheduler.md §5): the scheduler owns zero per-process
program-counter state — it lives in STATE-arena-allocated, A2-process-owned
ActivationRecord storage.
SC-127 scheduler-side resolution (Task 8, B-sched wave): the
scheduler places no restriction on where, syntactically or
call-stack-wise, a Suspend value is constructed inside resume().
resume() is a plain function returning a plain value — the dispatch
loop (sched::control::Engine::apply_suspend) matches only on the
returned Suspend variant, never on how deep in the call stack it was
built or what code ran to build it. A DPI-imported-task call site that
itself calls back into blocking SV (LRM 35.5.6) is therefore
representable today, with zero scheduler-side changes, exactly like this
module’s own sc127_a_mock_process_may_suspend_from_a_point_that_ stands_in_for_a_dpi_imported_task_callback test constructs: a Suspend
returned from several stack frames deep inside ordinary Rust calls
dispatches and completes identically to one returned directly from
resume’s own top-level match arm. What this does not resolve —
whether sv-sim-sim::process’s CFG builder / analysis::dpi actually
choose to treat a given DPI-imported-task call site as a suspend point at
all (i.e. which call sites qualify, and whether codegen ever emits one),
per SC-127’s own acceptance clause (a) vs. (b) — is that track’s decision,
not sched’s, and is cross-referenced here rather than silently assumed
resolved.
Required Methods§
Provided Methods§
Sourcefn mint_fork_child(&self, _spec: &SpawnSpec) -> Option<Box<dyn CompiledProcess>>
fn mint_fork_child(&self, _spec: &SpawnSpec) -> Option<Box<dyn CompiledProcess>>
Builds the real child process for one branch of a fork this process
just suspended on (Suspend::ForkJoin, PR-085). None means this
process has no compiled branch kernels to offer (every hand-written
test process); Engine then falls back to its inert placeholder
child. A compiled kernel process overrides this so sv-sim run
actually executes each branch body.
Sourcefn disable_instance(&self) -> Option<u32>
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).
Sourcefn disable_exit(&self, _label: &str) -> Option<u32>
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.
Sourcefn owns_disable_scope(&self, _label: &str) -> bool
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).
Sourcefn redirect_resume(&mut self, _pc: u32) -> bool
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).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".