[MLton-commit] r4565

Matthew Fluet MLton@mlton.org
Mon, 22 May 2006 15:46:29 -0700


Move n-way platform-arch #ifdef to cenv.h and include trivial platform/<arch>.h files
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
U   mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/alpha.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/amd64.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/arm.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/hppa.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/ia64.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/m68k.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/mips.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/powerpc.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/s390.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/sparc.h
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/x86.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform.h

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile	2006-05-22 22:46:27 UTC (rev 4565)
@@ -157,6 +157,7 @@
 	basis-ffi.h						\
 	platform.h						\
 	platform/$(TARGET_OS).h					\
+	platform/$(TARGET_ARCH).h				\
 	$(BASISHFILES)
 
 FILES = $(basename $(CFILES))

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -67,6 +67,33 @@
 #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
@@ -92,9 +119,7 @@
 #elif (defined (__sun__))
 #include "platform/solaris.h"
 #else
-#error unknown platform
+#error unknown platform os
 #endif
 
-
-
 #endif /* _MLTON_CENV_H_ */

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/alpha.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/alpha.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/alpha.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "alpha"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/amd64.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/amd64.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/amd64.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "amd64"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/arm.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/arm.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/arm.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "arm"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/hppa.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/hppa.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/hppa.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "hppa"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/ia64.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/ia64.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/ia64.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "ia64"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/m68k.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/m68k.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/m68k.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "m68k"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/mips.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/mips.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/mips.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "mips"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/powerpc.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/powerpc.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/powerpc.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "powerpc"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/s390.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/s390.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/s390.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "s390"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/sparc.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/sparc.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/sparc.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "sparc"

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/x86.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/x86.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/x86.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -0,0 +1 @@
+#define MLton_Platform_Arch_host "x86"

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2006-05-22 15:56:43 UTC (rev 4564)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2006-05-22 22:46:27 UTC (rev 4565)
@@ -13,6 +13,10 @@
 #include "util.h"
 #include "gc.h"
 
+#ifndef MLton_Platform_Arch_host
+#error MLton_Platform_Arch_host not defined
+#endif
+
 #ifndef MLton_Platform_OS_host
 #error MLton_Platform_OS_host not defined
 #endif
@@ -113,11 +117,12 @@
 #include "basis-ffi.h"
 
 /* ---------------------------------------------------------------- */
-/*                        Runtime Init/Exit                         */
+/*                        Runtime Init/Exit/Alloc                   */
 /* ---------------------------------------------------------------- */
 
 void MLton_init (int argc, char **argv, GC_state s);
 __attribute__ ((noreturn)) void MLton_exit (GC_state s, C_Int_t status);
+__attribute__ ((noreturn)) void MLton_allocTooLarge (void);
 
 /* ---------------------------------------------------------------- */
 /*                        Utility libraries                         */
@@ -173,40 +178,12 @@
 /*                       MLton                       */
 /* ------------------------------------------------- */
 
-__attribute__ ((noreturn)) void MLton_allocTooLarge (void);
-
 /* ---------------------------------- */
 /*           MLton.Platform           */
 /* ---------------------------------- */
 
 #define MLton_Platform_Arch_bigendian isBigEndian()
 
-#if (defined (__alpha__))
-#define MLton_Platform_Arch_host "alpha"
-#elif (defined (__x86_64__))
-#define MLton_Platform_Arch_host "amd64"
-#elif (defined (__arm__))
-#define MLton_Platform_Arch_host "arm"
-#elif (defined (__hppa__))
-#define MLton_Platform_Arch_host "hppa"
-#elif (defined (__ia64__))
-#define MLton_Platform_Arch_host "ia64"
-#elif (defined (__m68k__))
-#define MLton_Platform_Arch_host "m68k"
-#elif (defined (__mips__))
-#define MLton_Platform_Arch_host "mips"
-#elif (defined (__ppc__)) || (defined (__powerpc__))
-#define MLton_Platform_Arch_host "powerpc"
-#elif (defined (__s390__))
-#define MLton_Platform_Arch_host "s390"
-#elif (defined (__sparc__))
-#define MLton_Platform_Arch_host "sparc"
-#elif (defined (__i386__))
-#define MLton_Platform_Arch_host "x86"
-#else
-#error MLton_Platform_Arch_host not defined
-#endif
-
 extern Bool MLton_Platform_CygwinUseMmap;
 
 /* ------------------------------------------------- */