Make Mvm compile on MacOSX. Patch from Owen!

llvm-svn: 48818
diff --git a/vmkit/include/mvm/Threads/Cond.h b/vmkit/include/mvm/Threads/Cond.h
index 80b7a30..7534713 100644
--- a/vmkit/include/mvm/Threads/Cond.h
+++ b/vmkit/include/mvm/Threads/Cond.h
@@ -17,6 +17,8 @@
 #include "mvm/GC/GC.h"
 #include "mvm/Threads/Locks.h"
 
+#include <cstdlib>
+
 namespace mvm {
 
 class Cond {
@@ -27,7 +29,7 @@
   static Cond *allocCond(void);
   void broadcast(void);
   void wait(Lock *l);
-  int timed_wait(Lock *l, struct timeval *tv);
+  int timed_wait(Lock *l, timeval *tv);
   void signal(void);
 };
 
diff --git a/vmkit/lib/Mvm/Allocator/osdep.h b/vmkit/lib/Mvm/Allocator/osdep.h
index 0047e81..cd573e2 100644
--- a/vmkit/lib/Mvm/Allocator/osdep.h
+++ b/vmkit/lib/Mvm/Allocator/osdep.h
@@ -17,24 +17,8 @@
 #define PAGE_SHIFT		12
 #define PAGE_SIZE			(1 << PAGE_SHIFT)
 
-/* stdio.h */
-#include <stdio.h>
-
-__BEGIN_DECLS
-
-/* stdio.h */
-extern int   printf(const char *, ...);
-extern int   fprintf(FILE *, const char *, ...);
-extern int   vfprintf(FILE *, const char *, va_list);
-
-
-/* stdlib.h */
-extern void exit(int) throw ();
-
-/* string.h */
-extern void *memcpy(void *, const void *, size_t) throw ();
-//extern void  bzero(void *, size_t);
-
-__END_DECLS
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 #endif
diff --git a/vmkit/lib/Mvm/EscapeAnalysis.cpp b/vmkit/lib/Mvm/EscapeAnalysis.cpp
index 1e33f87..b7eb03f 100644
--- a/vmkit/lib/Mvm/EscapeAnalysis.cpp
+++ b/vmkit/lib/Mvm/EscapeAnalysis.cpp
@@ -14,6 +14,8 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 
+#include <map>
+
 using namespace llvm;
 
 namespace {
diff --git a/vmkit/lib/Mvm/Sigsegv.cc b/vmkit/lib/Mvm/Sigsegv.cc
index 66f0d6d..4be8b1f 100644
--- a/vmkit/lib/Mvm/Sigsegv.cc
+++ b/vmkit/lib/Mvm/Sigsegv.cc
@@ -38,17 +38,15 @@
 	void *caller_ip = caller->ip; 
 
 # if defined(__MACH__)
-  //.gregs[REG_EIP]; /* comme si c'était lui qui était sur la pile... */
-	caller->ip = (void *)((ucontext_t*)context)->uc_mcontext->ss.eip;
+  //.gregs[REG_EIP]; /* just like it's on the stack.. */
+	caller->ip = (void *)((ucontext_t*)context)->uc_mcontext->__ss.__eip;
 # else
   /* comme si c'était lui qui était sur la pile... */
 	caller->ip = (void *)((ucontext_t*)context)->uc_mcontext.gregs[REG_EIP]; 
 # endif
 #endif
 	
-	/* Il faut libérer le gc si il s'est planté tout seul pendant une collection.
-	   Ca le laisse dans un état TRES instable, c'est à dire que plus aucune
-     collection n'est possible */
+	/* Free the GC if it sisgegv'd. No other collection is possible */
 	gc::die_if_sigsegv_occured_during_collection(addr);
 	
 	//	sys_exit(0);
@@ -58,7 +56,7 @@
 		signal(SIGSEGV, SIG_DFL);
 	
 #if defined(__i386__)
-	caller->ip = caller_ip; /* restaure the caller ip */
+	caller->ip = caller_ip; /* restore the caller ip */
 #endif
 }