aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2018-12-24 00:02:35 +0100
committerCamil Staps2018-12-24 00:05:35 +0100
commit60dc2fefdfe2e311c656a3a3e9c6260f06d889ff (patch)
treec02f839b0d86c682c7f90c72c81d241f241dff27
parentInitial commit (diff)
Nicer output, add CI
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--Makefile7
-rw-r--r--sjit.icl16
3 files changed, 28 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..0f01b0e
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,8 @@
+test:
+ image: "camilstaps/clean:nightly"
+ before_script:
+ - install_clean_nightly.sh base lib-platform
+ - apt-get update -qq
+ - apt-get install -qq build-essential
+ script:
+ - make test
diff --git a/Makefile b/Makefile
index c4dbdac..4cbd9d9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
CLM:=clm
-CLMFLAGS:=-IL Platform
+CLMFLAGS:=-IL Platform -nr -nt
BIN:=sjit
all: $(BIN)
+test: $(BIN)
+ ./$<
+
$(BIN): %: %.icl Clean\ System\ Files/sjit_c.o .FORCE
$(CLM) $(CLMFLAGS) $@ -o $@
@@ -15,6 +18,6 @@ Clean\ System\ Files/sjit_c.o: sjit_c.c
clean:
$(RM) -r $(BIN) Clean\ System\ Files
-.PHONY: all clean
+.PHONY: all test clean
.FORCE:
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")}