feat(pbs): add sprite animation and shared Studio authoring
Implement DEC-0084 with factory-only Sprite/Animator structs, complete result lowering, validated animation sidecars, generated PBS factories and JavaFX/MCP authoring through shared services. Qualify native dev/release with ordinary and optimized producers, zero-allocation playback, private-cycle reclamation, canonical Composer pixels, installed JARs and JavaFX lifecycle. Preserve the runtime checkout and existing host ABI.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
//! PBS result groups execute on the unchanged production loader and VM.
|
||||
use super::*;
|
||||
use prometeu_vm::LogicalFrameEndingReason as End;
|
||||
use prometeu_bytecode::{decode_next, isa::core::CoreOpCode as Op};
|
||||
|
||||
pub fn verify(root: &std::path::Path) {
|
||||
let cases = [
|
||||
("unit-ok", vec![Value::Int32(0)]),
|
||||
("unit-err", vec![Value::Int32(2)]),
|
||||
("scalar", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("error", vec![Value::Int32(1), Value::Int64(0)]),
|
||||
("tuple", vec![Value::Int32(0), Value::Int64(9_007_199_254_740_993), Value::Int32(42)]),
|
||||
("reference", vec![Value::Int32(2), Value::Null]),
|
||||
("propagate", vec![Value::Int32(2), Value::Int64(0), Value::Null]),
|
||||
("nested", vec![Value::Int32(2), Value::Int32(0)]),
|
||||
("recover", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("remap", vec![Value::Int32(2), Value::Int32(0)]),
|
||||
("success", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("trait", vec![Value::Int32(1), Value::Null, Value::Null]),
|
||||
("fn", vec![Value::Int32(1), Value::Null]),
|
||||
("once", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("block-remap", vec![Value::Int32(2), Value::Int32(0)]),
|
||||
("reference-ok", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("fn-ok", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("trait-ok", vec![Value::Int32(0), Value::Int32(42)]),
|
||||
("color-ok", vec![Value::Int32(0), Value::Int64(42)]),
|
||||
("color-err", vec![Value::Int32(1), Value::Int64(0)]),
|
||||
("trap", vec![]),
|
||||
];
|
||||
let manifest = std::fs::read_to_string(root.join("pbs-result-manifest.txt")).expect("mandatory result manifest");
|
||||
assert_eq!(manifest.lines().count(), cases.len() * 2);
|
||||
for (name, expected) in cases { for suffix in ["", "-optimized"] {
|
||||
let bytes = std::fs::read(root.join(format!("pbs-result-{name}{suffix}.pbx"))).expect("mandatory result fixture");
|
||||
let image = ValidatedProgramImage::load(&bytes, &mut LoadBudget::new(LoadLimits::default()), caps::NONE)
|
||||
.unwrap_or_else(|e| panic!("result/{name}{suffix}: load {e:?}"));
|
||||
let mut vm = VirtualMachine::from_image(image.clone(), Default::default());
|
||||
vm.prepare_boot_call().unwrap();
|
||||
let mut allocations = 0;
|
||||
let mut trapped=false;
|
||||
for step in 0..100_000 {
|
||||
let instruction = decode_next(vm.pc(), image.code()).unwrap();
|
||||
if matches!(instruction.opcode, Op::StructNew | Op::ArrayNew | Op::MakeClosure) { allocations += 1; }
|
||||
let report = vm.run_budget(1, &mut NoNative, &mut HostContext::new(None))
|
||||
.unwrap_or_else(|e| panic!("result/{name}{suffix}: run {e:?}"));
|
||||
if matches!(report.reason, End::Trap(_)) && name=="trap" { trapped=true;break; }
|
||||
if matches!(report.reason, End::Halted | End::EndOfRom) { break; }
|
||||
assert!(matches!(report.reason, End::BudgetExhausted), "result/{name}{suffix}: {report:?}");
|
||||
assert!(step < 99_999, "result failed to terminate");
|
||||
}
|
||||
if name=="trap" { assert!(trapped,"handle must not recover a VM trap");println!("RESULT TRAP PASS {suffix}");continue; }
|
||||
assert_eq!(vm.operand_stack_top(expected.len()).iter().rev().cloned().collect::<Vec<_>>(), expected, "result/{name}{suffix}");
|
||||
if matches!(name,"reference-ok"|"fn-ok"|"trait-ok") { assert!(allocations>0,"successful payload is constructed"); }
|
||||
else { assert_eq!(allocations, 0, "result/{name}{suffix}: no holder or inactive payload allocations"); }
|
||||
println!("RESULT PASS {name}{suffix} group={expected:?} executed_allocations={allocations}");
|
||||
} }
|
||||
}
|
||||
Reference in New Issue
Block a user