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
+18 -1
View File
@@ -6,7 +6,7 @@ it does not implement a Java approximation of runtime admission.
From the Studio root:
```sh
./gradlew :prometeu-compiler:prometeu-build-pipeline:test --tests '*LinkedRegistryTest' --tests '*PbxRegistryConformanceTest' --tests '*TypedCommonPipelineTest'
./gradlew :prometeu-compiler:prometeu-build-pipeline:test --tests '*LinkedRegistryTest' --tests '*PbxRegistryConformanceTest' --tests '*TypedCommonPipelineTest' --tests '*RuntimeCatalogPipelineTest'
python3 tools/pbx-conformance/run.py --runtime ../runtime
```
@@ -45,3 +45,20 @@ remove the exception once the schema is corrected.
This corpus qualifies common backend production, not PBS lowering, lifecycle
selection, memcard persistence or installed-runtime deployment.
## Runtime catalog consumer fixtures
The catalog corpus adds common-IR Random calls with an aliased handle, a discarded
first result, mixed next/nextf/range calls and a subsequent next. The VM checks the
independent seed-42 handoff vector and identical charged work before/after
optimization. Constants are compared slot-by-slot against runtime materialization,
including exact Float bits and both slots of `vec2.zero`. Pool deduplication may
share a value but cannot omit a group component.
A known zero-argument touch query loads and traps `TRAP_UNAVAILABLE` without a
hardware context. A removed endpoint ID is rejected even after an unreachable
HALT. `color.html_rgba` executes with a String value and rejects a proven null
at load time, matching the runtime verifier's stricter rule despite the
dispatcher's nullable String carrier. These are distinct outcomes. Run the separate provider-export check with
`python3 tools/runtime-catalog/verify.py --runtime ../runtime` to compare the
selected source revision, imported CSV bytes and exporter output as well.
+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();