refactor(vm)!: remove publication and logical guard opcodes
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
Remove INDEX_GUARD, ARRAY_CHECK_LENGTH, STORAGE_PUBLISH and FIELDS_PUBLISH from decoding, metadata, tooling, verification and execution. Keep ARRAY_LEN and overlap-safe ARRAY_COPY with complete-group ownership and early charging of calculable copy work, including refused attempts. Update specifications, producer handoff, qualification evidence and lessons. Share collection test support and remove redundant Copy clones for Clippy. Validation: make ci-domains passed with 1,095 workspace tests, five separately executed debugger socket tests and all 15 unchanged coverage domain gates. VM release, resource diagnostics and layer/quality suites also passed. BREAKING CHANGE: PBX using opcodes 0xA7, 0xA8, 0xAA or 0xAB is rejected, including unreachable instructions. Consumers must adapt their emission and collection algorithms or operational guarantees.
This commit is contained in:
@@ -215,3 +215,62 @@ fn collection_effects_and_cached_initialization_width_are_exact() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn removed_storage_encodings_and_mnemonics_are_unsupported() {
|
||||
for opcode in [0xa7u16, 0xa8, 0xaa, 0xab] {
|
||||
assert!(Op::try_from(opcode).is_err());
|
||||
let bytes = opcode.to_le_bytes();
|
||||
assert!(
|
||||
matches!(decode_next(0,&bytes),Err(DecodeError::UnknownOpcode{pc:0,opcode: actual}) if actual == opcode)
|
||||
);
|
||||
assert!(disassemble(&bytes).is_err());
|
||||
}
|
||||
for text in
|
||||
["INDEX_GUARD", "ARRAY_CHECK_LENGTH 1", "STORAGE_PUBLISH 1,2,0,1", "FIELDS_PUBLISH 1"]
|
||||
{
|
||||
assert!(assemble(text).is_err(), "{text}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn range_copy_encoding_effects_and_registry_categories_are_independent_oracles() {
|
||||
let bytes = [0xa9, 0, 4, 3, 2, 1];
|
||||
assert_eq!(assemble("ARRAY_COPY 16909060").unwrap(), bytes);
|
||||
assert_eq!(disassemble(&bytes).unwrap(), "ARRAY_COPY 16909060");
|
||||
let instruction = decode_next(0, &bytes).unwrap();
|
||||
assert_eq!(instruction.opcode, Op::ArrayCopy);
|
||||
assert_eq!(instruction.opcode.cycles(), 4);
|
||||
let spec = instruction.opcode.spec();
|
||||
assert_eq!((spec.imm_bytes, spec.pops, spec.pushes), (4, None, None));
|
||||
assert!(instruction.opcode.requires_registry() && spec.may_trap);
|
||||
assert!(!spec.is_safepoint && !spec.is_branch && !spec.is_terminator);
|
||||
for end in 0..6 {
|
||||
assert!(decode_next(0, &bytes[..end]).is_err());
|
||||
}
|
||||
let registry = registry();
|
||||
let bytes = assemble("ARRAY_COPY 5").unwrap();
|
||||
assert_eq!(
|
||||
decode_next(0, &bytes).unwrap().registry_stack_effect(®istry).unwrap(),
|
||||
Some(RegistryStackEffect { pops: 5, pushes: 0 })
|
||||
);
|
||||
for (id, reason) in [
|
||||
(0, LoadReason::Category),
|
||||
(4, LoadReason::Category),
|
||||
(6, LoadReason::Category),
|
||||
(99, LoadReason::TypeId),
|
||||
] {
|
||||
let bytes = assemble(&format!("ARRAY_COPY {id}")).unwrap();
|
||||
let error = decode_next(0, &bytes).unwrap().registry_stack_effect(®istry).unwrap_err();
|
||||
assert_eq!(
|
||||
(error.code, error.reason, error.pc),
|
||||
(LoadCode::InvalidReference, reason, Some(0))
|
||||
);
|
||||
}
|
||||
for text in ["ARRAY_COPY", "ARRAY_COPY -1", "ARRAY_COPY 4294967296", "ARRAY_COPY 1 2"] {
|
||||
assert!(assemble(text).is_err());
|
||||
}
|
||||
// These are legal immediate bytes, not instruction boundaries.
|
||||
let bytes = assemble("PUSH_I64 18735214094965159\nHALT").unwrap();
|
||||
assert!(disassemble(&bytes).is_ok());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user