[MLton-commit] r4509

Matthew Fluet MLton@mlton.org
Tue, 9 May 2006 18:28:36 -0700


Wesley's patches for powerpc-darwin
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/sysconf-consts.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/util/Makefile

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/sysconf-consts.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/sysconf-consts.c	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/sysconf-consts.c	2006-05-10 01:28:35 UTC (rev 4509)
@@ -489,7 +489,7 @@
 #define _SC_XOPEN_SHM -1
 #endif
 const C_Int_t Posix_ProcEnv_SC_XOPEN_SHM = _SC_XOPEN_SHM;
-#ifndef __SC_XOPEN_STREAMS
+#ifndef _SC_XOPEN_STREAMS
 #define _SC_XOPEN_STREAMS -1
 #endif
 #ifndef _SC_XOPEN_STREAMS

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.c	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.c	2006-05-10 01:28:35 UTC (rev 4509)
@@ -23,7 +23,7 @@
   uintptr_t P_;
   pointer P;
 
-  if GC_MODEL_USEBASE {
+  if (GC_MODEL_USEBASE) {
     B_ = (uintptr_t)B;
   } else {
     B_ = 0;
@@ -44,7 +44,7 @@
   uintptr_t O_;
   objptr O;
 
-  if GC_MODEL_USEBASE {
+  if (GC_MODEL_USEBASE) {
     B_ = (uintptr_t)B;
   } else {
     B_ = 0;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c	2006-05-10 01:28:35 UTC (rev 4509)
@@ -8,21 +8,20 @@
 #include "mmap-protect.c"
 #include "use-mmap.c"
 
-void *getTextEnd () {
-        return (void*)(get_etext ());
+const void *GC_getTextEnd (void) {
+        return (const void*)(long)(get_etext ());
 }
 
-void *getTextStart () {
-        unsigned long address;
-        void *module;
-        struct mach_header *mh;
+const void *GC_getTextStart (void) {
+        void *address;
+        const struct mach_header *mh;
 
-        _dyld_lookup_and_bind ("_main", &address, &module);
+        _dyld_lookup_and_bind ("_main", &address, 0);
         mh = _dyld_get_image_header_containing_address (address);
         return mh;
 }
 
-void GC_displayMem () {
+void GC_displayMem (void) {
         /* FIXME: this won't actually work. */
         static char buffer[256];
 
@@ -41,7 +40,7 @@
         sa->sa_sigaction = (void (*)(int, siginfo_t*, void*))catcher;
 }
 
-W32 GC_totalRam (GC_state s) {
+size_t GC_totalRam (void) {
         int mem;
         size_t len;
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.h	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.h	2006-05-10 01:28:35 UTC (rev 4509)
@@ -32,3 +32,18 @@
 #define HAS_TIME_PROFILING TRUE
 
 #define MLton_Platform_OS_host "darwin"
+
+// MacOS doesn't support these... yet.
+#ifndef O_RSYNC
+#define O_RSYNC O_SYNC
+#endif
+#ifndef O_DSYNC
+#define O_DSYNC O_SYNC
+#endif
+
+// MacOS only defines this if POSIX_C_SOURCE is defined.
+// However, defining that breaks half the osx system headers.
+// They couldn't possibly change the number at this point anyways.
+#ifndef SIGPOLL
+#define SIGPOLL 7
+#endif

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c	2006-05-10 01:28:35 UTC (rev 4509)
@@ -2,9 +2,9 @@
 extern char _start;
 extern char etext;
 
-void *GC_getTextStart (void) {
+const void *GC_getTextStart (void) {
         return &_start;
 }
-void *GC_getTextEnd (void) {
+const void *GC_getTextEnd (void) {
         return &etext;
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform.h	2006-05-10 01:28:35 UTC (rev 4509)
@@ -156,8 +156,8 @@
 /*                Text Segment                       */
 /* ------------------------------------------------- */
 
-void *GC_getTextEnd (void);
-void *GC_getTextStart (void);
+const void *GC_getTextEnd (void);
+const void *GC_getTextStart (void);
 
 /* ------------------------------------------------- */
 /*                SigProf Handler                    */

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/Makefile	2006-05-10 01:19:57 UTC (rev 4508)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/Makefile	2006-05-10 01:28:35 UTC (rev 4509)
@@ -71,10 +71,10 @@
 DEBUGFLAGS = $(CFLAGS) -Wunused -gstabs+ -g2
 
 CFILES = 							\
-	$(shell find -type f | grep '\.c$$')
+	$(shell find . -type f | grep '\.c$$')
 
 HFILES = 							\
-	$(shell find -type f | grep '\.h$$')
+	$(shell find . -type f | grep '\.h$$')
 
 all: libgc.o libgc-gdb.o