Files
prometeu-runtime/docs/specs/runtime/09a-coroutines-and-cooperative-scheduling.md
T
bquarkz ec84a6bba5
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
feat(vm)!: implement typed callables and single-context execution
Add structural Fn signatures, typed capture environments, indirect calls and Trait dispatch while preserving logical parameter and result groups, ownership and budgets.

Remove guest coroutine execution and legacy loading. Activate bounded sealed PBX v1 with mandatory capture metadata, preserve frame continuations and root return results, and migrate producers and shipped cartridges.

Publish coordinated specs, handoffs and the completed runtime lesson. Validation: 880 workspace tests passed, 9 existing tests ignored; both cartridges completed six production-host frames.
2026-10-09 05:47:24 +01:00

37 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Single Execution Context and Frame Continuation
Domain: VM execution lifecycle
Function: normative
VM directly owns one PC, operand stack, call stack and globals. Entry preparation
does not allocate a heap execution object. There are no guest coroutine instances,
ready/sleeping queues, sleeper clock or coroutine scheduling phase.
SPAWN/YIELD/SLEEP are retired; 0x54–0x56 remain reserved. Loading MUST reject them
before execution, including unreachable code. Assembler rejects their mnemonics;
diagnostic decoding can identify retired numbers. No compatibility mode exists.
Other instruction numbers are unchanged.
FRAME_SYNC closes a logical frame and preserves context. It has zero stack effect,
is not a terminator, can occur in any body and resumes next PC. Host MUST NOT
prepare fresh entry solely because sync occurred. Budget exhaustion/breakpoints
preserve the same open frame without draw publication or extra callback budget.
Successful RET of the last root completes entry and leaves rooted results on VM
stack. Recurring host may prepare FunctionId 0 next logical frame, preserving
globals/init guard. Callee RET does not close a frame. Replacement preparation
validates/reserves before releasing owners. HALT/trap/reset/unload retain their
contracts.
Threshold GC opportunities are sync and successful root RET after result rooting.
Preparation, ordinary callee RET and allocation failure add no opportunity. GC
advances no clock/frame, grants no budget and invokes no guest cleanup/callback.
Asset/render workers retain their independent protocols and run no guest code;
no physical-core affinity is implied.
Persistent operations can advance through short steps in normal frame execution
and invoke typed Fn callbacks. UI/SDK APIs and future coroutine protocols require
separate contracts. See [Fn](02b-vm-function-values-and-closures.md),
[events](09-events-and-concurrency.md) and
[memory](03-memory-stack-heap-and-allocation.md).