feat(vm): add typed array and struct guest operations
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
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:
@@ -76,6 +76,46 @@ impl DecodedInstr<'_> {
|
||||
};
|
||||
(source_layout.storage.slots, pushes)
|
||||
}
|
||||
Op::StructNew
|
||||
| Op::StructGet
|
||||
| Op::StructSet
|
||||
| Op::ArrayNew
|
||||
| Op::ArrayLen
|
||||
| Op::ArrayGet
|
||||
| Op::ArraySet => {
|
||||
let (id, field) = if matches!(self.opcode, Op::StructGet | Op::StructSet) {
|
||||
self.imm_u32x2().map_err(|_| malformed())?
|
||||
} else {
|
||||
(self.imm_u32().map_err(|_| malformed())?, 0)
|
||||
};
|
||||
let (_, layout) = type_info(id)?;
|
||||
if matches!(self.opcode, Op::StructNew | Op::StructGet | Op::StructSet) {
|
||||
let instance = layout.instance.as_ref().ok_or_else(|| bad_category(id))?;
|
||||
match self.opcode {
|
||||
Op::StructNew => (0, 1),
|
||||
op => {
|
||||
let f = instance
|
||||
.fields
|
||||
.get(field as usize)
|
||||
.ok_or_else(|| bad_category(id).member(field))?;
|
||||
let w = registry.type_layout(f.type_id).unwrap().storage.slots;
|
||||
if op == Op::StructGet {
|
||||
(1, w)
|
||||
} else {
|
||||
(1 + w, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let array = layout.array.as_ref().ok_or_else(|| bad_category(id))?;
|
||||
let w = registry.type_layout(array.element_type_id).unwrap().storage.slots;
|
||||
match self.opcode {
|
||||
Op::ArrayNew | Op::ArrayLen => (1, 1),
|
||||
Op::ArrayGet => (2, w),
|
||||
_ => (2 + w, 0),
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => unreachable!("requires_registry is defined by the typed opcode catalogue"),
|
||||
};
|
||||
Ok(Some(RegistryStackEffect { pops, pushes }))
|
||||
|
||||
Reference in New Issue
Block a user