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:
@@ -12,3 +12,4 @@ prometeu-hal = { path = "../prometeu-hal" }
|
||||
|
||||
[dev-dependencies]
|
||||
prometeu-drivers = { path = "../prometeu-drivers" }
|
||||
prometeu-test-support = { path = "../../dev/prometeu-test-support" }
|
||||
|
||||
@@ -4,7 +4,8 @@ use crate::services::memcard::MemcardService;
|
||||
use prometeu_bytecode::TRAP_TYPE;
|
||||
use prometeu_bytecode::Value;
|
||||
use prometeu_bytecode::assembler::assemble;
|
||||
use prometeu_bytecode::model::{BytecodeModule, ConstantPoolEntry, FunctionMeta, SyscallDecl};
|
||||
use prometeu_bytecode::model::{ConstantPoolEntry, SyscallDecl};
|
||||
use prometeu_bytecode::registry::FunctionDecl;
|
||||
use prometeu_drivers::TestPlatform;
|
||||
use prometeu_drivers::{GlyphBankPoolInstaller, MemoryBanks, SceneBankPoolInstaller};
|
||||
use prometeu_hal::AudioOpStatus;
|
||||
@@ -22,6 +23,7 @@ use prometeu_hal::syscalls::caps;
|
||||
use prometeu_hal::tile::Tile;
|
||||
use prometeu_hal::tilemap::TileMap;
|
||||
use prometeu_hal::{InputSignals, RuntimePlatform};
|
||||
use prometeu_test_support::program::{TestProgram, int64_signature};
|
||||
use prometeu_vm::VmInitError;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
@@ -96,13 +98,17 @@ fn serialized_single_function_module_with_consts(
|
||||
const_pool: Vec<ConstantPoolEntry>,
|
||||
syscalls: Vec<SyscallDecl>,
|
||||
) -> Vec<u8> {
|
||||
BytecodeModule {
|
||||
version: 0,
|
||||
TestProgram {
|
||||
const_pool,
|
||||
functions: vec![FunctionMeta {
|
||||
functions: vec![FunctionDecl {
|
||||
code_offset: 0,
|
||||
code_len: code.len() as u32,
|
||||
..Default::default()
|
||||
|
||||
signature: int64_signature(0, 0),
|
||||
captures: vec![],
|
||||
name: None,
|
||||
local_slots: 0,
|
||||
max_stack_slots: 256,
|
||||
}],
|
||||
code,
|
||||
debug_info: None,
|
||||
@@ -233,6 +239,8 @@ fn initialize_vm_succeeds_when_cartridge_capabilities_cover_hostcalls() {
|
||||
|
||||
assert!(res.is_ok());
|
||||
assert_eq!(runtime.current_app_id, 42);
|
||||
assert!(vm.is_halted());
|
||||
vm.prepare_boot_call().unwrap();
|
||||
assert!(!vm.is_halted());
|
||||
}
|
||||
|
||||
@@ -679,40 +687,11 @@ fn tick_system_profile_can_use_shared_log_transport() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tick_returns_panic_report_distinct_from_trap() {
|
||||
let mut runtime = VirtualMachineRuntime::new(None);
|
||||
let mut log_service = LogService::new(4096);
|
||||
let mut fs = VirtualFS::new();
|
||||
let mut fs_state = FsState::Unmounted;
|
||||
let mut memcard = MemcardService::new();
|
||||
let mut open_files: HashMap<u32, String> = HashMap::new();
|
||||
let mut next_handle = 1;
|
||||
let mut vm = VirtualMachine::new(assemble("HOSTCALL 0\nHALT").expect("assemble"), vec![]);
|
||||
let mut platform = TestPlatform::new();
|
||||
let signals = InputSignals::default();
|
||||
|
||||
let report = runtime
|
||||
.tick(
|
||||
&mut log_service,
|
||||
&mut fs,
|
||||
&mut fs_state,
|
||||
&mut memcard,
|
||||
&mut open_files,
|
||||
&mut next_handle,
|
||||
&mut vm,
|
||||
&signals,
|
||||
&mut platform,
|
||||
)
|
||||
.expect("panic must surface as runtime error");
|
||||
|
||||
match report {
|
||||
CrashReport::VmPanic { message, pc } => {
|
||||
assert!(message.contains("HOSTCALL 0 reached execution without loader patching"));
|
||||
assert!(pc.is_some());
|
||||
}
|
||||
other => panic!("expected VmPanic crash report, got {:?}", other),
|
||||
}
|
||||
assert!(matches!(runtime.last_crash_report, Some(CrashReport::VmPanic { .. })));
|
||||
fn unpatched_hostcall_is_rejected_before_tick() {
|
||||
let bytes = serialized_single_function_module(assemble("HOSTCALL 0\nHALT").unwrap(), vec![]);
|
||||
let mut vm = VirtualMachine::default();
|
||||
assert!(vm.initialize(bytes).is_err());
|
||||
assert!(vm.is_halted());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -390,9 +390,8 @@ impl VirtualMachineRuntime {
|
||||
self.frame_scheduler.complete_game_frame();
|
||||
}
|
||||
|
||||
if run.reason == LogicalFrameEndingReason::FrameSync {
|
||||
self.needs_prepare_entry_call = true;
|
||||
}
|
||||
self.needs_prepare_entry_call =
|
||||
run.reason == LogicalFrameEndingReason::EndOfRom;
|
||||
|
||||
if self.debug_step_request {
|
||||
self.paused = true;
|
||||
|
||||
Reference in New Issue
Block a user