[MLton] the next public release

Jesper Louis Andersen jlouis@mongers.org
Mon, 16 Aug 2004 11:30:12 +0200


Quoting Jesper Louis Andersen (jlouis@mongers.org):

> I now have some profile enabling code for OpenBSD without the use of
> a SA_SIGINFO context. I'll try to convert it to use SA_SIGINFO to make
> it more on par with FreeBSD/Linux. After all the interface is conforming
> to POSIX and is a bit more powerful than the one NetBSD uses.

And I also have the converted code now. This will enable profiling
for OpenBSD on MLton. 

Index: mlton/main/main.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/main.fun,v
retrieving revision 1.55
diff -u -r1.55 main.fun
--- mlton/main/main.fun	13 Aug 2004 13:50:52 -0000	1.55
+++ mlton/main/main.fun	16 Aug 2004 07:18:53 -0000
@@ -619,6 +619,7 @@
 	    FreeBSD => ()
 	  | Linux => ()
 	  | NetBSD => ()
+          | OpenBSD => ()
 	  | Solaris => ()
 	  | _ =>
 	       if !profile = ProfileTime
Index: runtime/gc.c
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/gc.c,v
retrieving revision 1.192
diff -u -r1.192 gc.c
--- runtime/gc.c	12 Aug 2004 20:58:57 -0000	1.192
+++ runtime/gc.c	16 Aug 2004 07:19:07 -0000
@@ -3799,7 +3799,7 @@
 		profileWriteCount (s, p, fd, i + s->sourcesSize);
 }
 
-#if (defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) || defined (__sun__))
+#if (defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) || defined(__OpenBSD__) || defined (__sun__))
 
 #ifndef EIP
 #define EIP	14
@@ -3810,7 +3810,7 @@
 /*
  * Called on each SIGPROF interrupt.
  */
-#if (defined (__linux__) || defined (__FreeBSD__) || defined (__sun__))
+#if (defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__sun__))
 static void catcher (int sig, siginfo_t *sip, ucontext_t *ucp) {
 #elif (defined (__NetBSD__))
 static void catcher (int sig, int code, struct sigcontext *ucp) {
@@ -3827,7 +3827,7 @@
         pc = (pointer) ucp->uc_mcontext.gregs[EIP];
 #elif (defined (__FreeBSD__))
 	pc = (pointer) ucp->uc_mcontext.mc_eip;
-#elif (defined (__NetBSD__))
+#elif (defined (__NetBSD__) || defined (__OpenBSD__))
 	pc = (pointer) ucp->sc_eip;
 #elif (defined (__sun__))
 	pc = (pointer) ucp->uc_mcontext.gregs[REG_PC];
@@ -3927,7 +3927,7 @@
 	catcherState = s;
 	sa.sa_handler = (void (*)(int))catcher;
 	sigemptyset (&sa.sa_mask);
-#if (defined (__linux__) || defined(__FreeBSD__) || defined(__sun__))
+#if (defined (__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun__))
 	sa.sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
 #elif (defined (__NetBSD__))
 	sa.sa_flags = SA_ONSTACK | SA_RESTART;
@@ -3940,14 +3940,12 @@
 	setProfTimer (10000);
 }
 
-#elif (defined (__CYGWIN__) || defined (__OpenBSD__))
+#elif (defined (__CYGWIN__))
 
 /* No time profiling on this platform.  There is a check in mlton/main/main.fun
  * to make sure that time profiling is never turned on.
- * 
- * OpenBSD can probably do time profiling, but at the moment, we disable it to
- * get a working implementation fast.
  */
+
 static void profileTimeInit (GC_state s) {
 	die ("no time profiling");
 }

-- 
j.