ecs/xstage
cross-world (N-world) system scheduler.
Since: X3 (N-W-V0: N-world slot vectors + `*-n` entry points)
BoundXSystem
(defstruct BoundXSystem [])
an XSystem with world identities + boxed handles
Since: X3
make-bound-xsystem
(make-bound-xsystem)
low-level constructor.
Since: X3
bind-xsystem
(bind-xsystem)
resolve an XSystem against concrete worlds. `w0-id`
Since: X3
xsystem-conflicts?
(xsystem-conflicts? [a : BoundXSystem b : BoundXSystem] :)
true if two BoundXSystems cannot run
Since: X3
BoundXSystemN
(defstruct BoundXSystemN [])
an N-world system with world identities + boxed
make-bound-xsystem-n
(make-bound-xsystem-n)
low-level N-world constructor.
Since: N-W-V0
bind-xsystem-n
(bind-xsystem-n [sys & pairs])
resolve an XSystemN against concrete worlds.
XStage
(XStage)
heap container of scheduled systems, grouped into conflict-
Since: X3
xstage-new
(xstage-new :)
allocate an empty XStage.
Since: X3
xstage-len
(xstage-len [s : XStage] :)
count of systems added.
Since: X3
xstage-add!
(xstage-add! [s : XStage sys : BoundXSystem] :)
shared C snippet (inlined as a comment for
xstage-add-n!
(xstage-add-n! [s : XStage sys : BoundXSystemN] :)
append an N-world BoundXSystemN (ABI 1). The id /
xstage-n-waves
(xstage-n-waves [s : XStage] :)
wave count, recomputing if stale.
Since: X3
xstage-has-cycle?
(xstage-has-cycle? [s : XStage] :)
static well-formedness check. Builds the
Since: X3 (N-W-V0: ragged)
xstage-run!
(xstage-run! [s : XStage] :)
run every system, each against its bound worlds.
Since: X3
xstage-free!
(xstage-free! [s : XStage] :)
release the XStage's backing arrays, including each
Since: X3 (N-W-V0: free ragged slot vectors)
Internal definitions
xstage--bind-fills-- emit the per-slot `(xsm-set! __ids i WORLD-ID)`xstage-task-- pthread worker. Reads {fn, wps, abi} and calls the__xstage-recompute-waves-- greedy first-fit grouping under the__xstage-run-wave-raw-- dispatch the systems in `wave-idx`__xstage-dirty?-- internal staleness check.