on master help sign in
Merge pull request #1950 from Chobbes/master
62c386fEdwin Brady
rts/idris_gc.c+4−8
@@ -17,7 +17,6 @@ VAL copy(VM* vm, VAL x) {
17 } else {
17 } else {
18 allocCon(cl, vm, CTAG(x), ar, 1);
18 allocCon(cl, vm, CTAG(x), ar, 1);
19 for(i = 0; i < ar; ++i) {
19 for(i = 0; i < ar; ++i) {
20− // *argptr = copy(vm, *((VAL*)(x->info.c.args)+i)); // recursive version
21 cl->info.c.args[i] = x->info.c.args[i];
20 cl->info.c.args[i] = x->info.c.args[i];
22 }
21 }
23 }
22 }
@@ -90,9 +89,7 @@ void cheney(VM *vm) {
90 case CON:
89 case CON:
91 ar = ARITY(heap_item);
90 ar = ARITY(heap_item);
92 for(i = 0; i < ar; ++i) {
91 for(i = 0; i < ar; ++i) {
93− // printf("Copying %d %p\n", heap_item->info.c.tag, *argptr);
94 VAL newptr = copy(vm, heap_item->info.c.args[i]);
92 VAL newptr = copy(vm, heap_item->info.c.args[i]);
95− // printf("Got %p\t\t%p %p\n", newptr, scan, vm->heap_next);
96 heap_item->info.c.args[i] = newptr;
93 heap_item->info.c.args[i] = newptr;
97 }
94 }
98 break;
95 break;
@@ -111,7 +108,6 @@ void cheney(VM *vm) {
111void idris_gc(VM* vm) {
108void idris_gc(VM* vm) {
112 HEAP_CHECK(vm)
109 HEAP_CHECK(vm)
113 STATS_ENTER_GC(vm->stats, vm->heap.size)
110 STATS_ENTER_GC(vm->stats, vm->heap.size)
114− // printf("Collecting\n");
115
111
116 if (vm->heap.old != NULL)
112 if (vm->heap.old != NULL)
117 free(vm->heap.old);
113 free(vm->heap.old);
@@ -162,13 +158,13 @@ void idris_gc(VM* vm) {
162
158
163void idris_gcInfo(VM* vm, int doGC) {
159void idris_gcInfo(VM* vm, int doGC) {
164 printf("Stack: <BOT %p> <TOP %p>\n", vm->valstack, vm->valstack_top);
160 printf("Stack: <BOT %p> <TOP %p>\n", vm->valstack, vm->valstack_top);
165− printf("Final heap size %d\n", (int)(vm->heap.size));
161+ printf("Final heap size %zd\n", vm->heap.size);
166− printf("Final heap use %d\n", (int)(vm->heap.next - vm->heap.heap));
162+ printf("Final heap use %zd\n", vm->heap.next - vm->heap.heap);
167 if (doGC) { idris_gc(vm); }
163 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);
169#ifdef IDRIS_ENABLE_STATS
165#ifdef IDRIS_ENABLE_STATS
170 printf("Total allocations %" PRIu64 "\n", vm->stats.allocations);
166 printf("Total allocations %" PRIu64 "\n", vm->stats.allocations);
171#endif
167#endif
172− printf("Number of collections %d\n", vm->stats.collections);
168+ printf("Number of collections %" PRIu32 "\n", vm->stats.collections);
173
169
174}
170}
rts/idris_heap.c+2−2
@@ -10,8 +10,8 @@ void alloc_heap(Heap * h, size_t heap_size)
10 char * mem = malloc(heap_size);
10 char * mem = malloc(heap_size);
11 if (mem == NULL) {
11 if (mem == NULL) {
12 fprintf(stderr,
12 fprintf(stderr,
13− "RTS ERROR: Unable to allocate heap. Requested %d bytes.\n",
13+ "RTS ERROR: Unable to allocate heap. Requested %zd bytes.\n",
14− (int)heap_size);
14+ heap_size);
15 exit(EXIT_FAILURE);
15 exit(EXIT_FAILURE);
16 }
16 }
17
17