feat(vm)!: implement typed callables and single-context execution
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
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:
@@ -1,45 +1,21 @@
|
||||
//! Regression test: input is no longer exposed through the syscall registry.
|
||||
use prometeu_bytecode::isa::core::CoreOpCode as OpCode;
|
||||
use prometeu_hal::vm_fault::VmFault;
|
||||
use prometeu_vm::{HostContext, HostReturn, NativeInterface, VirtualMachine};
|
||||
|
||||
fn enc_op(op: OpCode) -> [u8; 2] {
|
||||
(op as u16).to_le_bytes()
|
||||
}
|
||||
|
||||
//! Removed native IDs cannot enter the sealed execution path.
|
||||
use prometeu_bytecode::assemble;
|
||||
use prometeu_test_support::program::{TestProgram, int64_signature};
|
||||
use prometeu_vm::{LoaderPatchError, ValidatedProgramImage, VmInitError};
|
||||
#[test]
|
||||
fn vm_rejects_legacy_input_syscall_id() {
|
||||
// Legacy input syscall id (PadGetUp) must now be rejected as unknown syscall.
|
||||
let mut rom = Vec::new();
|
||||
rom.extend_from_slice(&enc_op(OpCode::Syscall));
|
||||
rom.extend_from_slice(&0x2200u32.to_le_bytes());
|
||||
rom.extend_from_slice(&enc_op(OpCode::Halt));
|
||||
|
||||
struct NoopNative;
|
||||
impl NativeInterface for NoopNative {
|
||||
fn syscall(
|
||||
&mut self,
|
||||
_id: u32,
|
||||
_args: &[prometeu_bytecode::Value],
|
||||
_ret: &mut HostReturn,
|
||||
_ctx: &mut HostContext,
|
||||
) -> Result<(), VmFault> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
let mut vm = VirtualMachine::new(rom, vec![]);
|
||||
let mut native = NoopNative;
|
||||
let mut ctx = HostContext::new(None);
|
||||
vm.prepare_call("0").expect("prepare entry call");
|
||||
vm.set_capabilities(prometeu_hal::syscalls::caps::ALL);
|
||||
|
||||
let report = vm.run_budget(100, &mut native, &mut ctx).expect("VM run failed");
|
||||
match report.reason {
|
||||
prometeu_vm::LogicalFrameEndingReason::Trap(trap) => {
|
||||
assert_eq!(trap.code, prometeu_bytecode::TRAP_INVALID_SYSCALL);
|
||||
assert!(trap.message.contains("Unknown syscall"));
|
||||
}
|
||||
other => panic!("Expected invalid syscall trap, got {:?}", other),
|
||||
}
|
||||
fn loader_rejects_legacy_input_syscall_id() {
|
||||
let bytes =
|
||||
TestProgram::single(assemble("SYSCALL 0x2200\nHALT").unwrap(), int64_signature(0, 0), 0, 4)
|
||||
.serialize();
|
||||
assert!(matches!(
|
||||
ValidatedProgramImage::load(
|
||||
&bytes,
|
||||
&mut prometeu_bytecode::load_limits::LoadBudget::new(Default::default()),
|
||||
0
|
||||
),
|
||||
Err(VmInitError::LoaderPatchFailed(LoaderPatchError::RawSyscallInPreloadArtifact {
|
||||
syscall_id: 0x2200,
|
||||
..
|
||||
}))
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user