diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 20:59:31 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-31 21:00:13 +0000 |
commit | 036d3dcfba08e716356bb24ea2b11908c06f373a (patch) | |
tree | e14caf11cf6e906438d764b0127b40a435d0376f | |
parent | 4d8b855d87194b4a011211c7633af35704572a13 (diff) | |
download | ovm-036d3dcfba08e716356bb24ea2b11908c06f373a.tar.gz ovm-036d3dcfba08e716356bb24ea2b11908c06f373a.tar.bz2 ovm-036d3dcfba08e716356bb24ea2b11908c06f373a.zip |
vm_execute_all: Print every cycle on VERBOSE >= 2, just print final state otherwise
Changed VERBOSE checks to ensure a degree of information.
-rw-r--r-- | vm/runtime.c | 10 |
1 files changed, 7 insertions, 3 deletions
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); |