add FRAME_SYNC

This commit is contained in:
2026-03-24 13:40:29 +00:00
parent 55e97f4407
commit 2fb6fb2cda
7 changed files with 273 additions and 23 deletions
+6 -7
View File
@@ -63,13 +63,12 @@ fn test_canonical_cartridge_heartbeat() {
}
// 2. Deterministic output state (if any)
// In our frame(), z should be 30.
// Local 2 in frame() should be 30.
// Let's check the stack or locals if possible.
// The VM should have finished 'frame'.
// Since 'frame' returns void, the stack should be empty (or have the return value if any, but it's void).
assert_eq!(vm.operand_stack.len(), 0, "Stack should be empty after frame() execution");
// Observação: a PVM agora sinaliza FRAME_SYNC imediatamente antes do RET do entry point.
// Quando o motivo é FRAME_SYNC, não exigimos pilha vazia (a limpeza final ocorre após o RET).
// Para os demais motivos (RET/Halted/EndOfRom), a pilha deve estar vazia para frame(): void.
if !matches!(report.reason, LogicalFrameEndingReason::FrameSync) {
assert_eq!(vm.operand_stack.len(), 0, "Stack should be empty after frame() execution");
}
println!("Heartbeat test passed!");
}