feat(vm): add typed array and struct guest operations
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good

Add seven Registry-backed collection opcodes with bounded verification, complete value groups, transactional publication and exact attempt costs. Publish ISA, memory and cycle contracts, producer handoff and the completed lesson.

Validate with 925 workspace tests, optimized collection suites and all eight coverage domain gates. Make headless fixture directory names unique for parallel tests.
This commit is contained in:
2026-10-08 10:36:20 +01:00
parent 8732f4b0f4
commit 86bade3e1f
27 changed files with 1591 additions and 46 deletions
@@ -410,6 +410,34 @@ fn transfer(
working[base + offset] = Fact::Carrier(abi_mask(*abi));
}
}
Op::StructNew | Op::ArrayNew => {
group(
&mut working[base..],
registry,
TypeId(instruction.imm_u32().unwrap()),
(instruction.pc as u64) << 32,
budget,
)?;
}
Op::ArrayLen => {
budget.work(1)?;
working[base] = Fact::Carrier(I64);
}
Op::StructGet | Op::ArrayGet => {
budget.work(3)?;
let (id, field) = if instruction.opcode == Op::StructGet {
instruction.imm_u32x2().unwrap()
} else {
(instruction.imm_u32().unwrap(), 0)
};
let layout = registry.type_layout(TypeId(id)).unwrap();
let ty = if instruction.opcode == Op::StructGet {
layout.instance.as_ref().unwrap().fields[field as usize].type_id
} else {
layout.array.unwrap().element_type_id
};
group(&mut working[base..], registry, ty, (instruction.pc as u64) << 32, budget)?;
}
Op::DynPack => {
budget.work(1)?;
let ty = TypeId(instruction.imm_u32().unwrap());
@@ -651,6 +679,32 @@ fn check(
base += registry.type_layout(parameter.type_id).unwrap().storage.slots as usize;
}
}
Op::ArrayNew => require(working[end - 1], I64, 0, registry, budget)?,
Op::StructGet | Op::StructSet | Op::ArrayLen | Op::ArrayGet | Op::ArraySet => {
budget.work(3)?;
let (id, field) = if matches!(instruction.opcode, Op::StructGet | Op::StructSet) {
instruction.imm_u32x2().unwrap()
} else {
(instruction.imm_u32().unwrap(), 0)
};
let ty = TypeId(id);
let effect = instruction.registry_stack_effect(registry)?.unwrap();
let base = end - effect.pops as usize;
check_group(&working[base..base + 1], ty, registry, budget)?;
let array = matches!(instruction.opcode, Op::ArrayGet | Op::ArraySet);
if array {
require(working[base + 1], I64, 1, registry, budget)?;
}
if matches!(instruction.opcode, Op::StructSet | Op::ArraySet) {
let layout = registry.type_layout(ty).unwrap();
let value_ty = if array {
layout.array.unwrap().element_type_id
} else {
layout.instance.as_ref().unwrap().fields[field as usize].type_id
};
check_group(&working[base + 1 + usize::from(array)..], value_ty, registry, budget)?;
}
}
Op::DynPack => {
budget.work(1)?;
let ty = TypeId(instruction.imm_u32().unwrap());