feat(vm)!: implement typed callables and single-context execution
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good

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.
This commit is contained in:
2026-10-09 05:47:24 +01:00
parent 86bade3e1f
commit ec84a6bba5
96 changed files with 3656 additions and 6075 deletions
@@ -1,5 +1,7 @@
//! Independent catalogue and execution oracles for the fixed input ABI.
use prometeu_bytecode::{TRAP_INVALID_INTRINSIC, TRAP_UNAVAILABLE, Value, assembler::assemble};
use prometeu_test_support::program::{TestProgram, int64_signature};
use prometeu_vm::ValidatedProgramImage;
// Independent catalogue and execution oracles for the fixed input ABI.
use prometeu_bytecode::{TRAP_UNAVAILABLE, Value, assembler::assemble};
use prometeu_drivers::TestPlatform;
use prometeu_hal::{InputSignals, RuntimePlatform, vm_fault::VmFault};
use prometeu_vm::{
@@ -188,7 +190,7 @@ fn vm_queries_charge_one_cycle_each_and_allocate_no_guest_objects() {
for id in 0x2100..=0x2135 {
source.push_str(&format!("INTRINSIC {id}\n"));
}
let mut vm = VirtualMachine::new(assemble(&source).unwrap(), vec![]);
let mut vm = query_vm(assemble(&(source + "HALT\n")).unwrap());
vm.prepare_call("0").expect("prepare entry call");
let objects = vm.heap().len();
let mut platform = TestPlatform::new();
@@ -216,16 +218,36 @@ fn every_known_query_faults_when_unavailable_and_rejects_arguments() {
(meta.implementation)(&[Value::Int64(0)], &mut ctx),
Err(IntrinsicExecutionError::ArityMismatch { expected: 0, got: 1 })
);
let mut vm = VirtualMachine::new(assemble(&format!("INTRINSIC {id}\n")).unwrap(), vec![]);
let mut vm = query_vm(assemble(&format!("INTRINSIC {id}\nHALT")).unwrap());
vm.prepare_call("0").expect("prepare entry call");
let report = vm.run_budget(10, &mut NoSyscalls, &mut ctx).unwrap();
assert!(matches!(report.reason, LogicalFrameEndingReason::Trap(trap)
if trap.code == TRAP_UNAVAILABLE && trap.pc == 0));
assert!(vm.operand_stack_top(1).is_empty());
}
let mut vm = VirtualMachine::new(assemble("INTRINSIC 0x2136\n").unwrap(), vec![]);
vm.prepare_call("0").expect("prepare entry call");
let report = vm.run_budget(10, &mut NoSyscalls, &mut HostContext::new(None)).unwrap();
assert!(matches!(report.reason, LogicalFrameEndingReason::Trap(trap)
if trap.code == TRAP_INVALID_INTRINSIC));
let bytes = TestProgram::single(
assemble("INTRINSIC 0x2136\nHALT").unwrap(),
int64_signature(0, 0),
0,
64,
)
.serialize();
let error = ValidatedProgramImage::load(
&bytes,
&mut prometeu_bytecode::load_limits::LoadBudget::new(Default::default()),
0,
)
.unwrap_err();
assert!(matches!(error, prometeu_vm::VmInitError::RegistryLoadFailed(_)));
}
fn query_vm(code: Vec<u8>) -> VirtualMachine {
let bytes = TestProgram::single(code, int64_signature(0, 0), 0, 64).serialize();
let image = ValidatedProgramImage::load(
&bytes,
&mut prometeu_bytecode::load_limits::LoadBudget::new(Default::default()),
0,
)
.unwrap();
VirtualMachine::from_image(image, Default::default())
}