[MLton-commit] r4747

Matthew Fluet fluet at mlton.org
Sat Oct 21 19:49:17 PDT 2006


Fixed gcc cast warnings introduced in r4743
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c	2006-10-22 02:33:18 UTC (rev 4746)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c	2006-10-22 02:49:16 UTC (rev 4747)
@@ -203,8 +203,7 @@
   }
 }
 
-
-GC_profileData GC_profileMalloc (GC_state s) {
+GC_profileData profileMalloc (GC_state s) {
   GC_profileData p;
   uint32_t profileMasterLength;
 
@@ -218,17 +217,27 @@
       (struct GC_profileStack *)
       (calloc_safe(profileMasterLength, sizeof(*(p->stack))));
   if (DEBUG_PROFILE)
-    fprintf (stderr, FMTPTR" = GC_profileMalloc ()\n", (uintptr_t)p);
+    fprintf (stderr, FMTPTR" = profileMalloc ()\n", (uintptr_t)p);
   return p;
 }
 
-void GC_profileFree (GC_state s, GC_profileData p) {
+GC_profileData GC_profileMalloc (GC_state s) {
+  return profileMalloc (s);
+}
+
+void profileFree (GC_state s, GC_profileData p) {
+  if (DEBUG_PROFILE)
+    fprintf (stderr, "profileFree ("FMTPTR")\n", (uintptr_t)p);
   free (p->countTop);
   if (s->profiling.stack)
     free (p->stack);
   free (p);
 }
 
+void GC_profileFree (GC_state s, GC_profileData p) {
+  profileFree (s, p);
+}
+
 void writeProfileCount (GC_state s, FILE *f,
                         GC_profileData p, GC_profileMasterIndex i) {
   writeUintmaxU (f, p->countTop[i]);
@@ -244,13 +253,13 @@
   writeNewline (f);
 }
 
-void GC_profileWrite (GC_state s, GC_profileData p, NullString8_t fileName) {
+void profileWrite (GC_state s, GC_profileData p, const char *fileName) {
   FILE *f;
   const char* kind;
 
   if (DEBUG_PROFILE)
-    fprintf (stderr, "GC_profileWrite\n");
-  f = fopen_safe ((const char*)fileName, "wb");
+    fprintf (stderr, "profileWrite("FMTPTR",%s)\n", (uintptr_t)p, fileName);
+  f = fopen_safe (fileName, "wb");
   writeString (f, "MLton prof\n");
   kind = "";
   switch (s->profiling.kind) {
@@ -291,6 +300,9 @@
   fclose_safe (f);
 }
 
+void GC_profileWrite (GC_state s, GC_profileData p, NullString8_t fileName) {
+  profileWrite (s, p, (const char*)fileName);
+}
 
 void setProfTimer (long usec) {
   struct itimerval iv;
@@ -352,7 +364,7 @@
 static void initProfilingTime (GC_state s) {
   struct sigaction sa;
 
-  s->profiling.data = GC_profileMalloc (s);
+  s->profiling.data = profileMalloc (s);
   if (PROFILE_TIME_LABEL == s->profiling.kind) {
     initTextSources (s);
   } else {
@@ -397,7 +409,7 @@
   s = atexitForProfilingState;
   if (s->profiling.isOn) {
     fprintf (stderr, "profiling is on\n");
-    GC_profileWrite (s, s->profiling.data, "mlmon.out");
+    profileWrite (s, s->profiling.data, "mlmon.out");
   }
 }
 
@@ -410,7 +422,7 @@
     switch (s->profiling.kind) {
     case PROFILE_ALLOC:
     case PROFILE_COUNT:
-      s->profiling.data = GC_profileMalloc (s);
+      s->profiling.data = profileMalloc (s);
       break;
     case PROFILE_NONE:
       die ("impossible PROFILE_NONE");

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h	2006-10-22 02:33:18 UTC (rev 4746)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h	2006-10-22 02:49:16 UTC (rev 4747)
@@ -98,6 +98,10 @@
 
 static void writeProfileCount (GC_state s, FILE *f, GC_profileData p, GC_profileMasterIndex i);
 
+GC_profileData profileMalloc (GC_state s);
+void profileWrite (GC_state s, GC_profileData p, const char* fileName);
+void profileFree (GC_state s, GC_profileData p);
+
 static void setProfTimer (long usec);
 static void initProfilingTime (GC_state s);
 static void atexitForProfiling (void);




More information about the MLton-commit mailing list