aboutsummaryrefslogtreecommitdiff
path: root/sjit.icl
diff options
context:
space:
mode:
Diffstat (limited to 'sjit.icl')
-rw-r--r--sjit.icl16
1 files changed, 15 insertions, 1 deletions
diff --git a/sjit.icl b/sjit.icl
index e0c1bef..8c86fc1 100644
--- a/sjit.icl
+++ b/sjit.icl
@@ -3,8 +3,10 @@ module sjit
import StdEnv
import StdGeneric
import StdMaybe
+
from Data.Func import mapSt, $
from Data.Map import :: Map(..), get, put, newMap, fromList
+import System.CommandLine
import code from "sjit_c."
@@ -169,7 +171,19 @@ where
ccall jit "A:I"
}
-Start = (exec prog, jit prog)
+import Text.GenPrint
+derive gPrint Instr
+
+Start w
+# (io,w) = stdio w
+# io = io <<< "Program: " <<< printToString prog <<< "\n"
+# io = io <<< "Interpreted result: " <<< interpreted_result <<< "\n"
+# io = io <<< "JIT-compiled result: " <<< jit_compiled_result <<< "\n"
+# (_,w) = fclose io w
+= setReturnCode (if (interpreted_result==jit_compiled_result) 0 1) w
+where
+ interpreted_result = exec prog
+ jit_compiled_result = jit prog
prog =: compile
[ {fun_name="id", fun_expr=Abstr ["x"] (Var "x")}