Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Contracts and edge cases

Platform spec article

Contracts and edge cases

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki
IDRequirement
GC-001All heap objects must carry type descriptors reachable from the object header for precise scanning.
GC-002Pointer stores in generated code must lower to gc_write_barrier when concurrent marking is enabled.
GC-003Phase A must execute at most one Beskid mutator performing allocations at a time.
GC-004gc_collect / gc_collect_if_needed must be safe to call from host tooling when runtime scope is entered.
GC-005External roots must pair gc_register_root with gc_unregister_root (or handle APIs) to avoid leaks.
GC-006Stack maps must be emitted for functions that hold GC pointers across safepoints.
GC-007Phase B mutators must attach to a shared heap through attach_phase_b_mutator (or an equivalent runtime scope) before allocating or reading GC-managed pointers.
GC-008Syscall-pool worker threads must not allocate on the Beskid heap; the runtime must trap the violation when assertions are enabled.
GC-009Pointer-payload channel transfers must apply the insertion write barrier on both send and receive paths, and must keep the in-flight pointer reachable via an external GC handle while it sits in the queue.
GC-010Optional preemption (runtime_preempt_check) must be a no-op when preemption is disabled and must never block a syscall-pool worker thread.
SymbolReturnsSemantics
gc_bytes_allocatedi64Total allocated bytes (diagnostic)
gc_object_counti64Live object estimate
gc_phasei64Phase enum 0/1/2
gc_write_barriervoidBarrier hook
gc_root_handlei64Temporary external pin
channel_send_ptr / channel_receive_ptri64 statusPointer-payload channel ops with barrier and external-handle handoff
runtime_preempt_checkvoidOptional safe-point hook; yields when preemption is enabled
CaseBehavior
Null pointer storeLowering should avoid barrier; runtime barrier on null should no-op
Fiber migration mid-markScheduler holds mutator lock; no second mutator attaches (Phase A only)
Multiple Phase B mutators on one heapEach thread holds a MutatorAttachGuard; shared heap + per-thread GC context
Full heap during str_concatPanic/trap — matches allocation failure policy
Conservative fallbackForbidden — Beskid uses precise descriptors only
Syscall-pool worker accidentally allocatesassert_mutator_allowed panics; the worker is not a mutator
Pointer-payload channel sender from a non-fiber OS threadBackpressure resolved by try_send + thread::yield_now, never park_current

Reference counting, conservative GC, and region-only allocation are rejected for v0.2; see legacy Concurrent GC decision summary.