diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-29 23:10:17 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-29 23:10:17 +0000 |
commit | 70c8a03939a3cb1f1797ea2cb212a8a41933cb71 (patch) | |
tree | 0d21e74694ea80da3763bbc1a843e2fe8b4da6fa /vm | |
parent | 60588129b45d0dbd603c79c02929480799c992f3 (diff) | |
download | ovm-70c8a03939a3cb1f1797ea2cb212a8a41933cb71.tar.gz ovm-70c8a03939a3cb1f1797ea2cb212a8a41933cb71.tar.bz2 ovm-70c8a03939a3cb1f1797ea2cb212a8a41933cb71.zip |
Fixed logs in vm/runtime
Just changing some messages and the format of heap printing
Diffstat (limited to 'vm')
-rw-r--r-- | vm/runtime.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/vm/runtime.c b/vm/runtime.c index 664fa25..006ce6b 100644 --- a/vm/runtime.c +++ b/vm/runtime.c @@ -421,9 +421,8 @@ void vm_stop(vm_t *vm) "]: Heap: %luB (over %lu %s) not reclaimed\n", total_capacity, vm->heap.pages, vm->heap.pages == 1 ? "page" : "pages"); - printf("\t[" TERM_RED "DATA" TERM_RESET "]: Complete breakdown:\n"); for (size_t i = 0; i < vm->heap.pages; i++) - printf("\t\t[%lu]: %luB bytes lost\n", i, capacities[i]); + printf("\t\t[%lu]: %luB lost\n", i, capacities[i]); } if (vm->stack.ptr > 0) { @@ -533,7 +532,7 @@ void vm_print_heap(vm_t *vm, FILE *fp) fprintf(fp, "\n"); for (size_t i = 0; i < heap.pages; ++i) { - fprintf(fp, "\tPage[%lu]: ", i); + fprintf(fp, "\t[%lu]@%p: ", i, cur); if (!cur) fprintf(fp, "<NIL>\n"); else @@ -541,13 +540,13 @@ void vm_print_heap(vm_t *vm, FILE *fp) fprintf(fp, "{"); for (size_t j = 0; j < cur->available; ++j) { + if ((j % 8) == 0) + fprintf(fp, "\n\t\t"); fprintf(fp, "%x", cur->data[j]); if (j != cur->available - 1) - fprintf(fp, ", "); - else if ((j % 8) == 7) - fprintf(fp, ",\n\t\t"); + fprintf(fp, ",\t"); } - fprintf(fp, "}\n"); + fprintf(fp, "\n\t}\n"); cur = cur->next; } } |