[MLton-commit] r4679

Ville Laurikari MLton@mlton.org
Sat, 8 Jul 2006 09:02:21 -0700


Updated AIX port.

Moved the n-way OS #ifdef before the n-way arch #ifdef, since on AIX
we don't seem to have __ppc__ or __powerpc__ defined by the system.

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

A   mlton/branches/on-20050822-x86_64-branch/basis-library/config/c/powerpc-aix/c-types.sml
U   mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.h

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

Added: mlton/branches/on-20050822-x86_64-branch/basis-library/config/c/powerpc-aix/c-types.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library/config/c/powerpc-aix/c-types.sml	2006-07-05 23:07:49 UTC (rev 4678)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library/config/c/powerpc-aix/c-types.sml	2006-07-08 16:02:19 UTC (rev 4679)
@@ -0,0 +1,131 @@
+(* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh
+ *    Jagannathan, and Stephen Weeks.
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+
+(* C *)
+structure C_Char = struct open Word8 type t = word end
+functor C_Char_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word8 (A)
+structure C_SChar = struct open Int8 type t = int end
+functor C_SChar_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int8 (A)
+structure C_UChar = struct open Word8 type t = word end
+functor C_UChar_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word8 (A)
+structure C_Short = struct open Int16 type t = int end
+functor C_Short_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int16 (A)
+structure C_SShort = struct open Int16 type t = int end
+functor C_SShort_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int16 (A)
+structure C_UShort = struct open Word16 type t = word end
+functor C_UShort_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word16 (A)
+structure C_Int = struct open Int32 type t = int end
+functor C_Int_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_SInt = struct open Int32 type t = int end
+functor C_SInt_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_UInt = struct open Word32 type t = word end
+functor C_UInt_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_Long = struct open Int32 type t = int end
+functor C_Long_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_SLong = struct open Int32 type t = int end
+functor C_SLong_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_ULong = struct open Word32 type t = word end
+functor C_ULong_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_LongLong = struct open Int64 type t = int end
+functor C_LongLong_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int64 (A)
+structure C_SLongLong = struct open Int64 type t = int end
+functor C_SLongLong_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int64 (A)
+structure C_ULongLong = struct open Word64 type t = word end
+functor C_ULongLong_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word64 (A)
+structure C_Float = struct open Real32 type t = real end
+functor C_Float_ChooseRealN (A: CHOOSE_REALN_ARG) = ChooseRealN_Real32 (A)
+structure C_Double = struct open Real64 type t = real end
+functor C_Double_ChooseRealN (A: CHOOSE_REALN_ARG) = ChooseRealN_Real64 (A)
+structure C_Size = struct open Word32 type t = word end
+functor C_Size_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+structure C_Pointer = struct open Word32 type t = word end
+functor C_Pointer_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_String = struct open Word32 type t = word end
+functor C_String_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_StringArray = struct open Word32 type t = word end
+functor C_StringArray_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* Generic integers *)
+structure C_Fd = C_Int
+functor C_Fd_ChooseIntN (A: CHOOSE_INTN_ARG) = C_Int_ChooseIntN (A)
+structure C_Signal = C_Int
+functor C_Signal_ChooseIntN (A: CHOOSE_INTN_ARG) = C_Int_ChooseIntN (A)
+structure C_Status = C_Int
+functor C_Status_ChooseIntN (A: CHOOSE_INTN_ARG) = C_Int_ChooseIntN (A)
+structure C_Sock = C_Int
+functor C_Sock_ChooseIntN (A: CHOOSE_INTN_ARG) = C_Int_ChooseIntN (A)
+
+(* C99 *)
+structure C_Ptrdiff = struct open Int32 type t = int end
+functor C_Ptrdiff_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_Intmax = struct open Int64 type t = int end
+functor C_Intmax_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int64 (A)
+structure C_UIntmax = struct open Word64 type t = word end
+functor C_UIntmax_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word64 (A)
+structure C_Intptr = struct open Int32 type t = int end
+functor C_Intptr_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_UIntptr = struct open Word32 type t = word end
+functor C_UIntptr_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <dirent.h> *)
+structure C_DirP = struct open Word32 type t = word end
+functor C_DirP_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <poll.h> *)
+structure C_NFds = struct open Word32 type t = word end
+functor C_NFds_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <resource.h> *)
+structure C_RLim = struct open Word32 type t = word end
+functor C_RLim_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <sys/types.h> *)
+structure C_Clock = struct open Int32 type t = int end
+functor C_Clock_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_Dev = struct open Word32 type t = word end
+functor C_Dev_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_GId = struct open Word32 type t = word end
+functor C_GId_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_Id = struct open Word32 type t = word end
+functor C_Id_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_INo = struct open Word32 type t = word end
+functor C_INo_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_Mode = struct open Word32 type t = word end
+functor C_Mode_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_NLink = struct open Int16 type t = int end
+functor C_NLink_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int16 (A)
+structure C_Off = struct open Int32 type t = int end
+functor C_Off_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_PId = struct open Int32 type t = int end
+functor C_PId_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_SSize = struct open Int32 type t = int end
+functor C_SSize_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_SUSeconds = struct open Int32 type t = int end
+functor C_SUSeconds_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_Time = struct open Int32 type t = int end
+functor C_Time_ChooseIntN (A: CHOOSE_INTN_ARG) = ChooseIntN_Int32 (A)
+structure C_UId = struct open Word32 type t = word end
+functor C_UId_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <sys/socket.h> *)
+structure C_Socklen = struct open Word32 type t = word end
+functor C_Socklen_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from <termios.h> *)
+structure C_CC = struct open Word8 type t = word end
+functor C_CC_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word8 (A)
+structure C_Speed = struct open Word32 type t = word end
+functor C_Speed_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+structure C_TCFlag = struct open Word32 type t = word end
+functor C_TCFlag_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+
+(* from "gmp.h" *)
+structure C_MPLimb = struct open Word32 type t = word end
+functor C_MPLimb_ChooseWordN (A: CHOOSE_WORDN_ARG) = ChooseWordN_Word32 (A)
+

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-07-05 23:07:49 UTC (rev 4678)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-07-08 16:02:19 UTC (rev 4679)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
  *    Jagannathan, and Stephen Weeks.
  * Copyright (C) 1997-2000 NEC Research Institute.
  *
@@ -55,7 +55,6 @@
 COMPILE_TIME_ASSERT(CHAR_BIT__is_eight, CHAR_BIT == 8);
 COMPILE_TIME_ASSERT(sizeof_float__is_four, sizeof(float) == 4);
 COMPILE_TIME_ASSERT(sizeof_double__is_eight, sizeof(double) == 8);
-COMPILE_TIME_ASSERT(char__is_signed, CHAR_MIN < 0);
 
 #include <fcntl.h>
 #include <unistd.h>
@@ -67,34 +66,6 @@
 
 #include "gmp.h"
 
-
-#if (defined (__alpha__))
-#include "platform/alpha.h"
-#elif (defined (__x86_64__))
-#include "platform/amd64.h"
-#elif (defined (__arm__))
-#include "platform/arm.h"
-#elif (defined (__hppa__))
-#include "platform/hppa.h"
-#elif (defined (__ia64__))
-#include "platform/ia64.h"
-#elif (defined (__m68k__))
-#include "platform/m68k.h"
-#elif (defined (__mips__))
-#include "platform/mips.h"
-#elif (defined (__ppc__)) || (defined (__powerpc__))
-#include "platform/powerpc.h"
-#elif (defined (__s390__))
-#include "platform/s390.h"
-#elif (defined (__sparc__))
-#include "platform/sparc.h"
-#elif (defined (__i386__))
-#include "platform/x86.h"
-#else
-#error unknown platform arch
-#endif
-
-
 #if (defined (__APPLE_CC__))
 #define __Darwin__
 #endif
@@ -123,4 +94,32 @@
 #error unknown platform os
 #endif
 
+
+#if (defined (__alpha__))
+#include "platform/alpha.h"
+#elif (defined (__x86_64__))
+#include "platform/amd64.h"
+#elif (defined (__arm__))
+#include "platform/arm.h"
+#elif (defined (__hppa__))
+#include "platform/hppa.h"
+#elif (defined (__ia64__))
+#include "platform/ia64.h"
+#elif (defined (__m68k__))
+#include "platform/m68k.h"
+#elif (defined (__mips__))
+#include "platform/mips.h"
+#elif (defined (__ppc__)) || (defined (__powerpc__))
+#include "platform/powerpc.h"
+#elif (defined (__s390__))
+#include "platform/s390.h"
+#elif (defined (__sparc__))
+#include "platform/sparc.h"
+#elif (defined (__i386__))
+#include "platform/x86.h"
+#else
+#error unknown platform arch
+#endif
+
+
 #endif /* _MLTON_CENV_H_ */

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.c	2006-07-05 23:07:49 UTC (rev 4678)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.c	2006-07-08 16:02:19 UTC (rev 4679)
@@ -11,23 +11,24 @@
 #include <sys/vminfo.h>
 
 #include "diskBack.unix.c"
-#include "getrusage.c"
 #include "mkdir2.c"
+#include "mmap-protect.c"
+#include "nonwin.c"
 #include "recv.nonblock.c"
-#include "ssmmap.c"
+#include "sysconf.c"
 #include "use-mmap.c"
 
-int fegetround(void)
+int fegetround (void)
 {
         return fp_read_rnd ();
 }
 
-void fesetround(int mode)
+void fesetround (int mode)
 {
         fp_swap_rnd (mode);
 }
 
-int fpclassify64(double d)
+int fpclassify64 (double d)
 {
         int c;
         c = class (d);
@@ -52,20 +53,9 @@
         }
 }
 
-W32 totalRam (GC_state s) {
-        struct vminfo info;
-        int pagesize;
-
-        pagesize = sysconf (_SC_PAGESIZE);
-        if (vmgetinfo (&info, VMINFO, sizeof(info)) < 0)
-                diee ("totalRam error: vmgetinfo failed\n");
-        return info.memsizepgs * pagesize;
-}
-
-
 struct map_type {
         int flag;
-        char *type;
+        const char *type;
 };
 
 static struct map_type map_types[] =
@@ -79,7 +69,7 @@
 struct map_segment {
         prptr64_t start;
         prptr64_t end;
-        char *name;
+        const char *name;
 };
 
 static struct map_segment map_segments[] =
@@ -99,8 +89,8 @@
          {0, 0, NULL}};
 
 
-static char *
-get_map_type(int flags, prptr64_t addr)
+static const char *
+get_map_type (int flags, prptr64_t addr)
 {
         struct map_type *m;
 
@@ -113,8 +103,8 @@
         return "";
 }
 
-static char *
-get_map_segment(prptr64_t addr)
+static const char *
+get_map_segment (prptr64_t addr)
 {
         struct map_segment *m;
 
@@ -126,7 +116,7 @@
 
 #define BUFLEN 65536
 
-void showMem(void)
+void GC_displayMem (void)
 {
         pid_t pid = getpid ();
         char fname[128];

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.h	2006-07-05 23:07:49 UTC (rev 4678)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/aix.h	2006-07-08 16:02:19 UTC (rev 4679)
@@ -36,17 +36,7 @@
 #define FE_UPWARD     2 // FP_RND_RP
 #define FE_DOWNWARD   3 // FP_RND_RM
 
-enum {
-        FP_NAN,
-        FP_INFINITE,
-        FP_ZERO,
-        FP_SUBNORMAL,
-        FP_NORMAL
-};
-
 int fpclassify64(double d);
 
 /* This should not conflict with existing flags. */
 #define MSG_DONTWAIT 0x1000000
-
-extern char **environ; /* for Posix_ProcEnv_environ */