From 036d3dcfba08e716356bb24ea2b11908c06f373a Mon Sep 17 00:00:00 2001
From: Aryadev Chavali <aryadev@aryadevchavali.com>
Date: Tue, 31 Oct 2023 20:59:31 +0000
Subject: vm_execute_all: Print every cycle on VERBOSE >= 2, just print final
 state otherwise

Changed VERBOSE checks to ensure a degree of information.
---
 vm/runtime.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'vm')

diff --git a/vm/runtime.c b/vm/runtime.c
index 6fd6ab4..d188b29 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -231,15 +231,17 @@ err_t vm_execute_all(vm_t *vm)
 {
   struct Program *program = &vm->program;
   err_t err               = ERR_OK;
-#if VERBOSE == 1
+#if VERBOSE >= 1
+  size_t cycles = 0;
+#endif
+#if VERBOSE >= 2
   struct Registers prev_registers = vm->registers;
-  size_t cycles                   = 0;
   size_t prev_sptr                = 0;
 #endif
   while (program->instructions[program->ptr].opcode != OP_HALT &&
          program->ptr < program->max)
   {
-#if VERBOSE >= 1
+#if VERBOSE >= 2
     fprintf(stdout, "[vm_execute_all]: Trace(Cycle %lu)\n", cycles);
     fputs(
         "----------------------------------------------------------------------"
@@ -269,6 +271,8 @@ err_t vm_execute_all(vm_t *vm)
             "----------\n",
             stdout);
     }
+#endif
+#if VERBOSE >= 1
     ++cycles;
 #endif
     err = vm_execute(vm);
-- 
cgit v1.2.3-13-gbd6f