diff src/compiler.sml @ 183:c0ea24dcb86f

Optimizing 'case' in Mono_reduce
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 13:30:27 -0400
parents 80192edca30d
children 88d46972de53
line wrap: on
line diff
--- a/src/compiler.sml	Sun Aug 03 12:43:20 2008 -0400
+++ b/src/compiler.sml	Sun Aug 03 13:30:27 2008 -0400
@@ -422,6 +422,19 @@
     handle CjrEnv.UnboundNamed n =>
            print ("Unbound named " ^ Int.toString n ^ "\n")
 
+fun compileC {cname, oname, ename} =
+    let
+        val compile = "gcc -O3 -I include -c " ^ cname ^ " -o " ^ oname
+        val link = "gcc -pthread -O3 clib/lacweb.o " ^ oname ^ " clib/driver.o -o " ^ ename
+    in
+        if not (OS.Process.isSuccess (OS.Process.system compile)) then
+            print "C compilation failed\n"
+        else if not (OS.Process.isSuccess (OS.Process.system link)) then
+                print "C linking failed\n"
+        else
+            print "Success\n"
+    end
+
 fun compile job =
     case cjrize job of
         NONE => print "Laconic compilation failed\n"
@@ -431,21 +444,13 @@
             val oname = "/tmp/lacweb.o"
             val ename = "/tmp/webapp"
 
-            val compile = "gcc -O3 -I include -c " ^ cname ^ " -o " ^ oname
-            val link = "gcc -pthread -O3 clib/lacweb.o " ^ oname ^ " clib/driver.o -o " ^ ename
-
             val outf = TextIO.openOut cname
             val s = TextIOPP.openOut {dst = outf, wid = 80}
         in
             Print.fprint s (CjrPrint.p_file CjrEnv.empty file);
             TextIO.closeOut outf;
 
-            if not (OS.Process.isSuccess (OS.Process.system compile)) then
-                print "C compilation failed\n"
-            else if not (OS.Process.isSuccess (OS.Process.system link)) then
-                print "C linking failed\n"
-            else
-                print "Success\n"
+            compileC {cname = cname, oname = oname, ename = ename}
         end
 
 end