cleanup: #define and use OS_VM_SIZE_FMT in write_generation_stats
authorNikodemus Siivola <nikodemus@random-state.net>
Fri, 25 Nov 2011 12:53:22 +0000 (14:53 +0200)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 27 Nov 2011 11:19:03 +0000 (13:19 +0200)
src/runtime/gencgc.c
src/runtime/os.h

index 9ba41fb..652733f 100644 (file)
@@ -498,18 +498,20 @@ write_generation_stats(FILE *file)
                 " %5"PAGE_INDEX_FMT" %5"PAGE_INDEX_FMT,
                 boxed_cnt, unboxed_cnt, large_boxed_cnt,
                 large_unboxed_cnt, pinned_cnt);
-        fprintf(file
-                " %8ld %5ld %8ld %4ld %3d %7.4f\n",
+        fprintf(file,
+                " %8"OS_VM_SIZE_FMT
+                " %5"OS_VM_SIZE_FMT
+                " %8"OS_VM_SIZE_FMT
+                " %4"PAGE_INDEX_FMT" %3d %7.4f\n",
                 generations[i].bytes_allocated,
-                (npage_bytes(count_generation_pages(i))
-                 - generations[i].bytes_allocated),
+                (npage_bytes(count_generation_pages(i)) - generations[i].bytes_allocated),
                 generations[i].gc_trigger,
                 count_write_protect_generation_pages(i),
                 generations[i].num_gc,
                 generation_average_age(i));
     }
-    fprintf(file,"   Total bytes allocated    = %lu\n", (unsigned long)bytes_allocated);
-    fprintf(file,"   Dynamic-space-size bytes = %lu\n", (unsigned long)dynamic_space_size);
+    fprintf(file,"   Total bytes allocated    = %"OS_VM_SIZE_FMT"\n", bytes_allocated);
+    fprintf(file,"   Dynamic-space-size bytes = %"OS_VM_SIZE_FMT"\n", dynamic_space_size);
 
     fpu_restore(fpu_state);
 }
index 814b18d..8384ef3 100644 (file)
@@ -179,4 +179,14 @@ int os_get_errno(void);
  * returned, it must be 'free'd. */
 extern char *os_get_runtime_executable_path(int external_path);
 
+/* Write platforms specific ones when necessary. This is to get us off
+ * the ground. */
+#if N_WORD_BITS == 32
+# define OS_VM_SIZE_FMT "u"
+# define OS_VM_SIZE_FMTX "x"
+#else
+# define OS_VM_SIZE_FMT "lu"
+# define OS_VM_SIZE_FMTX "lx"
+#endif
+
 #endif