feat(compiler): port runtime catalogs and enforce target ABI (AGD77)

Import both runtime catalogs and provenance, port all intrinsic metadata and exact constants, and validate target signatures and carriers through the common pipeline. Package matching compiler/SDK resources and add active parity plus production runtime conformance checks.

Validation: 420 compiler/PBS tests passed, with 12 existing skips; provider export, runtime execution and installed catalog checks passed. The pre-existing Gfx.clear typed-metadata failure remains active and assigned to AGD78 under the explicitly accepted scope revision recorded in LSN-0080.
This commit is contained in:
2026-10-15 13:07:49 +01:00
parent bd5694dbdf
commit 603ed01227
32 changed files with 1356 additions and 457 deletions
+53
View File
@@ -36,6 +36,7 @@ impl NativeInterface for NoNative {
fn main() {
let root = std::path::PathBuf::from(std::env::args().nth(1).expect("fixture directory"));
verify_catalog_fixtures(&root);
for name in [
"minimal",
"jump-end",
@@ -257,6 +258,58 @@ fn main() {
);
}
fn verify_catalog_fixtures(root: &std::path::Path) {
use prometeu_vm::LogicalFrameEndingReason as End;
let mut random_cycles = None;
for name in ["catalog-random-off", "catalog-random-on", "catalog-constants", "catalog-vec2-zero", "catalog-input", "catalog-string"] {
let bytes = std::fs::read(root.join(format!("{name}.pbx"))).unwrap();
let image = ValidatedProgramImage::load(&bytes, &mut LoadBudget::new(LoadLimits::default()), caps::NONE)
.unwrap_or_else(|error| panic!("{name}: {error:?}"));
println!("LOAD PASS {name}");
let mut vm = VirtualMachine::from_image(image, Default::default());
vm.prepare_boot_call().unwrap();
let report = vm.run_budget(10000, &mut NoNative, &mut HostContext::new(None)).unwrap();
if name == "catalog-input" {
assert!(matches!(report.reason, End::Trap(ref trap) if trap.code == prometeu_bytecode::TRAP_UNAVAILABLE));
println!("EXEC PASS {name}: TRAP_UNAVAILABLE (known query, no hardware)");
continue;
}
assert!(matches!(report.reason, End::Halted | End::EndOfRom), "{name}: {report:?}");
if name.starts_with("catalog-random-") {
// Independent seed-42 vector and unit-range consumption from the provider handoff/tests.
assert_eq!(vm.operand_stack_top(3), vec![
Value::Int64(0xF9090E529A7DAE00u64 as i64), Value::Int64(-7),
Value::Float(f64::from_bits(0x3FB304AA46C98538)),
], "{name}: aliasing, discarded first next, mixed operations and exact order");
if let Some(cycles) = random_cycles { assert_eq!(report.cycles_used, cycles, "optimization changed charged work"); }
random_cycles = Some(report.cycles_used);
} else if name == "catalog-vec2-zero" {
assert_eq!(vm.operand_stack_top(2), vec![Value::Float(0.0), Value::Float(0.0)]);
} else if name == "catalog-string" {
assert_eq!(vm.operand_stack_top(1), vec![Value::Int64(0xAABBCCDD)]);
} else {
let mut constants: Vec<_> = prometeu_vm::builtin_constant_catalog().collect();
constants.sort_by_key(|constant| constant.key.key());
let mut expected = Vec::new();
for constant in constants { expected.extend(constant.materialize().unwrap()); }
expected.reverse();
let actual = vm.operand_stack_top(expected.len());
assert_eq!(actual.len(), 16);
for (actual, expected) in actual.iter().zip(expected.iter()) {
match (actual, expected) {
(Value::Float(a), Value::Float(b)) => assert_eq!(a.to_bits(), b.to_bits()),
_ => assert_eq!(actual, expected),
}
}
}
println!("EXEC PASS {name}: {} cycles, {} steps", report.cycles_used, report.steps_executed);
}
let removed = std::fs::read(root.join("catalog-removed.pbx")).unwrap();
reject(root, "catalog-removed", &removed, LoadLimits::default());
let null_string = std::fs::read(root.join("catalog-null-string.pbx")).unwrap();
reject(root, "catalog-null-string", &null_string, LoadLimits::default());
}
fn reject(root: &std::path::Path, name: &str, bytes: &[u8], limits: LoadLimits) {
let error =
ValidatedProgramImage::load(bytes, &mut LoadBudget::new(limits), caps::NONE).unwrap_err();