feat(runtime): add optional pause and resume lifecycle hooks
Intrepid/Prometeu/Runtime/pipeline/pr-master Build started...

This commit is contained in:
2026-10-13 12:18:18 +01:00
parent 23dc6fc66d
commit 0af8b2b1fe
39 changed files with 1381 additions and 70 deletions
@@ -76,13 +76,15 @@ call and capture access validate whole groups and reserve capacity before consum
or publication. Refusal preserves operands/owners and publishes no partial object
or frame; provisional reservations refund and attempted cycles remain. No quota
rescue GC. Use existing distinct NullReference/InvalidHandle/Type/Resource traps.
Fn can invoke syscalls, mutate and fault: no purity flag, fault isolation, separate
budget, guest unwind or rollback of earlier body effects.
Ordinary Fn calls can invoke syscalls, mutate and fault: no purity flag, fault
isolation, separate budget, guest unwind or rollback of earlier body effects.
SystemOS lifecycle invocations use the separate budget described below.
## 5 Context, GC and Host
VM owns one PC, operand/call stacks and globals directly. FRAME_SYNC retains
frames/locals/environments and resumes next PC in any body. Budget exhaustion
frames/locals/environments and resumes next PC in normal gameplay bodies. It is
forbidden during lifecycle hooks and their callees. Budget exhaustion
retains the same logical frame. Last-root RET completes entry, rooting results
before threshold GC. Recurring host entry remains FunctionId 0 with init once.
@@ -92,8 +94,9 @@ and legally retained native/host roots. Trace whole capture groups and shared
cells; unreachable cycles collect. Results remain roots until consumed/replaced,
reset/unload. No GC at ordinary callee RET or allocation/quota rescue.
HeapRef copies/inspection snapshots establish no guest roots or cross-session
imports. No native registration/delivery/reentry API is created here. Guest
callbacks are ordinary Fn calls in the main execution context.
imports. Ordinary guest callbacks are Fn calls in the main execution context.
Optional SystemOS lifecycle entry uses Registry roles and the controlled boundary
described below; it does not introduce arbitrary native reentry.
See [memory](03-memory-stack-heap-and-allocation.md),
[Registry/PBX](02c-program-registry-and-pbx-v1.md) and
@@ -102,3 +105,14 @@ See [memory](03-memory-stack-heap-and-allocation.md),
## Random core integration
[Random references](02e-vm-owned-random-core.md) are valid capture, parameter and result groups. Existing roots retain the generator; copying captures aliases its state.
## System-owned lifecycle entry
Optional zero-argument, zero-result, capture-free lifecycle targets are bound by
[Registry roles](02c-program-registry-and-pbx-v1.md#optional-lifecycle-roles).
They are ordinary functions called through a controlled SystemOS boundary, not
closure values or replacement boot entries. The boundary retains the existing
stacks and roots, appends its frame, and returns to SystemOS immediately on outer
completion. See [lifecycle execution](09a-coroutines-and-cooperative-scheduling.md#controlled-lifecycle-calls)
for independent fuel, debugger behavior and failure semantics. Frontend Init and
Frame assembly is unchanged.