on master help sign in
Merge pull request #1950 from Chobbes/master

Correct format strings for idris_gcInfo.

commit62c386f4bfcd133d85e64af337f00445590e3a15 authorEdwin Brady <edwin.brady@gmail.com> dateThu 5 Mar 2015, 22:14 (12 years ago) parentec06f94954d071
2 files changed+6−10
rts/idris_gc.c+4−8 rts/idris_heap.c+2−2
rts/idris_gc.c+4−8
@@ -17,7 +17,6 @@ VAL copy(VM* vm, VAL x) {
1717 } else {
1818 allocCon(cl, vm, CTAG(x), ar, 1);
1919 for(i = 0; i < ar; ++i) {
20− // *argptr = copy(vm, *((VAL*)(x->info.c.args)+i)); // recursive version
2120 cl->info.c.args[i] = x->info.c.args[i];
2221 }
2322 }
@@ -90,9 +89,7 @@ void cheney(VM *vm) {
9089 case CON:
9190 ar = ARITY(heap_item);
9291 for(i = 0; i < ar; ++i) {
93− // printf("Copying %d %p\n", heap_item->info.c.tag, *argptr);
9492 VAL newptr = copy(vm, heap_item->info.c.args[i]);
95− // printf("Got %p\t\t%p %p\n", newptr, scan, vm->heap_next);
9693 heap_item->info.c.args[i] = newptr;
9794 }
9895 break;
@@ -111,7 +108,6 @@ void cheney(VM *vm) {
111108void idris_gc(VM* vm) {
112109 HEAP_CHECK(vm)
113110 STATS_ENTER_GC(vm->stats, vm->heap.size)
114− // printf("Collecting\n");
115111
116112 if (vm->heap.old != NULL)
117113 free(vm->heap.old);
@@ -162,13 +158,13 @@ void idris_gc(VM* vm) {
162158
163159void idris_gcInfo(VM* vm, int doGC) {
164160 printf("Stack: <BOT %p> <TOP %p>\n", vm->valstack, vm->valstack_top);
165− printf("Final heap size %d\n", (int)(vm->heap.size));
166− printf("Final heap use %d\n", (int)(vm->heap.next - vm->heap.heap));
161+ printf("Final heap size %zd\n", vm->heap.size);
162+ printf("Final heap use %zd\n", vm->heap.next - vm->heap.heap);
167163 if (doGC) { idris_gc(vm); }
168− printf("Final heap use after GC %d\n", (int)(vm->heap.next - vm->heap.heap));
164+ printf("Final heap use after GC %zd\n", vm->heap.next - vm->heap.heap);
169165#ifdef IDRIS_ENABLE_STATS
170166 printf("Total allocations %" PRIu64 "\n", vm->stats.allocations);
171167#endif
172− printf("Number of collections %d\n", vm->stats.collections);
168+ printf("Number of collections %" PRIu32 "\n", vm->stats.collections);
173169
174170}
rts/idris_heap.c+2−2
@@ -10,8 +10,8 @@ void alloc_heap(Heap * h, size_t heap_size)
1010 char * mem = malloc(heap_size);
1111 if (mem == NULL) {
1212 fprintf(stderr,
13− "RTS ERROR: Unable to allocate heap. Requested %d bytes.\n",
14− (int)heap_size);
13+ "RTS ERROR: Unable to allocate heap. Requested %zd bytes.\n",
14+ heap_size);
1515 exit(EXIT_FAILURE);
1616 }
1717