Verified Commit 73a21af6 authored by Camil Staps's avatar Camil Staps 🚀

Rename tools; use patched cpm in CI

parent c96e9b25
......@@ -7,9 +7,9 @@ stages:
.base:
image: camilstaps/abc-interpreter
before_script:
- ln -s "$PWD/src/optimise" /opt/clean/lib/exe/optimise
- ln -s "$PWD/src/abcopt" /opt/clean/lib/exe/abcopt
- ln -s "$PWD/src/bcgen" /opt/clean/lib/exe/bcgen
- ln -s "$PWD/src/link" /opt/clean/lib/exe/bclink
- ln -s "$PWD/src/bclink" /opt/clean/lib/exe/bclink
- make -C src
- clm -bytecode -O _system
......@@ -29,7 +29,7 @@ build-windows:
extends: .base
stage: build
script:
- CC=x86_64-w64-mingw32-gcc OS=Windows_NT make -B -C src bcgen link interpret
- CC=x86_64-w64-mingw32-gcc OS=Windows_NT make -B -C src bcgen bclink interpret
test-gc:
extends: .base
......
......@@ -14,8 +14,20 @@ RUN \
time\
bc
RUN install_clean_nightly.sh base lib-platform lib-dynamics lib-graphcopy
RUN install_clean_nightly.sh base lib-directory lib-dynamics lib-graphcopy lib-platform
COPY etc/ByteCode.env ByteCode.env
RUN tail -n +3 ByteCode.env /opt/clean/etc/IDEEnvs
RUN git clone https://gitlab.science.ru.nl/cstaps/clean-tools /tmp/clean-tools &&\
make -C /tmp/clean-tools/clm -f Makefile.linux64 &&\
mv /tmp/clean-tools/clm/clm /opt/clean/bin
mv /tmp/clean-tools/clm/clm /opt/clean/bin &&\
cd /tmp && rm -r clean-tools
RUN git clone https://gitlab.science.ru.nl/cstaps/clean-ide /tmp/clean-ide &&\
cd /tmp/clean-ide/cpm &&\
clm -h 256m -nr -nt\
-I Posix -I ../BatchBuild -I ../Pm -I ../Unix -I ../Util -I ../Interfaces/LinkerInterface\
-IL Directory -IL Platform -IL Platform/Deprecated/ArgEnv -IL Platform/Deprecated/Generics -IL Platform/Deprecated/StdLib\
Cpm -o cpm &&\
mv cpm /opt/clean/bin &&\
cd /tmp && rm -r clean-ide
......@@ -14,15 +14,15 @@ the run-time system for the interpreter:
clm fsieve
# Optimise ABC code
optimise "Clean System Files/fsieve.abc" -o "Clean System Files/fsieve.opt.abc"
optimise "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.abc" -o "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.opt.abc"
abcopt "Clean System Files/fsieve.abc" -o "Clean System Files/fsieve.opt.abc"
abcopt "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.abc" -o "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.opt.abc"
# Generate bytecode
bcgen "Clean System Files/fsieve.opt.abc" -o "Clean System Files/fsieve.obc"
bcgen "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.opt.abc" -o "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.obc"
# Link bytecode
link "Clean System Files/fsieve.obc" "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.obc" i_system.obc -o fsieve.bc
bclink "Clean System Files/fsieve.obc" "$CLEAN_HOME/lib/StdEnv/Clean System Files/StdReal.obc" i_system.obc -o fsieve.bc
# Interpret bytecode
interpret fsieve.bc
......@@ -33,12 +33,12 @@ debug fsieve.bc
## Detailed descriptions
### optimise
### abcopt
Optimises ABC code. This removes unnecessary instructions, shrinks instruction
blocks, and introduces many new ABC instructions for frequently used blocks.
Usage: `optimise ABC -o OABC`
Usage: `abcopt ABC -o OABC`
### bcgen
......@@ -50,13 +50,13 @@ In principle, `bcgen` can handle multiple ABC files and link them together.
However, this is not used any more since we have a linker. Thus, it is safer to
generate bytecode for every tool separately and link them together with `link`.
### link
### bclink
Links bytecode files together.
Since there is no `start` field in the bytecode, execution always starts at
address 0. Thus, the first OBC file should be that of the main module.
Usage: `link OBC [OBC ...] -o BC`
Usage: `bclink OBC [OBC ...] -o BC`
### interpret
......
Version: 1.0
Environments
Environment
EnvironmentName: ByteCode
EnvironmentPaths
Path: {Application}/lib/StdEnv
EnvironmentCompiler: lib/exe/cocl
EnvironmentABCOptimise: lib/exe/abcopt
EnvironmentByteCodeGen: lib/exe/bcgen
EnvironmentByteCodeLink: lib/exe/bclink
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: lib/exe/linker:-no-pie
EnvironmentDynLink: lib/exe/linker:-no-pie
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: True
abcopt
bcgen
bclink
debug
interpret
link
optimise
graph_copy_with_names.dcl
graph_copy_with_names.icl
......
......@@ -7,6 +7,7 @@ import StdClass
import StdFile
import StdGeneric
import StdInt
import StdList
import StdString
isAStackInstruction :: ABCInstruction -> Bool
......@@ -31,8 +32,9 @@ printInstruction{|Char|} c = printChar c
where
printChar :: !Char -> String
printChar c
| c < ' ' || c > '~' = {#'\'','\\',oct (ic / 64),oct ((ic rem 64) / 8),oct (ic rem 8),'\''}
| otherwise = {#'\'',c,'\''}
| c < ' ' || c > '~' || isMember c ['\\\'']
= {#'\'','\\',oct (ic / 64),oct ((ic rem 64) / 8),oct (ic rem 8),'\''}
= {#'\'',c,'\''}
where
ic = toInt c
oct i = "01234567".[i]
......
......@@ -31,7 +31,7 @@ ifeq ($(USING_CLANG),0)
override CFLAGS+=-Wno-misleading-indentation
endif
BINARIES:=optimise bcgen link interpret
BINARIES:=abcopt bcgen bclink interpret
PATCHED:=graph_copy_with_names.dcl graph_copy_with_names.icl
INTERPRET_LIB:=Clean\ System\ Files/interpret.a
......@@ -52,14 +52,14 @@ $(PATCHED): %: $(CLEAN_HOME)/lib/GraphCopy/% %.patch
patch < $@.patch
ifeq ($(OS),Windows_NT)
optimise.prj: optimise_win.prj.default
abcopt.prj: abcopt_win.prj.default
cp $< $@
else
optimise.prj: optimise.prj.default
abcopt.prj: abcopt.prj.default
cp $< $@
endif
optimise: optimise.prj .FORCE
abcopt: abcopt.prj .FORCE
$(CPM) project $@.prj build
SRC_BCGEN:=\
......@@ -69,22 +69,22 @@ SRC_BCGEN:=\
bcgen_instruction_table.c\
parse_abc.c\
util.c
DEP_BYTECODE:=$(subst .c,.h,$(SRC_BCGEN)) settings.h
DEP_BCGEN:=$(subst .c,.h,$(SRC_BCGEN)) settings.h
bcgen: $(SRC_BCGEN) $(DEP_BYTECODE)
bcgen: $(SRC_BCGEN) $(DEP_BCGEN)
$(CC) $(CFLAGS) $(CLIBS) $(SRC_BCGEN) -DBC_GEN -o $@
SRC_LINK:=\
SRC_BCLINK:=\
abc_instructions.c\
bcgen_instructions.c\
bclink.c\
bytecode.c\
link.c\
parse.c\
util.c
DEP_LINK:=$(subst .c,.h,$(SRC_LINK)) settings.h
DEP_BCLINK:=$(subst .c,.h,$(SRC_BCLINK)) settings.h
link: $(SRC_LINK) $(DEP_LINK)
$(CC) $(CFLAGS) $(CLIBS) -UCOMPUTED_GOTOS $(SRC_LINK) -DLINKER -o $@
bclink: $(SRC_BCLINK) $(DEP_BCLINK)
$(CC) $(CFLAGS) $(CLIBS) -UCOMPUTED_GOTOS $(SRC_BCLINK) -DLINKER -o $@
SRC_INTERPRET:=\
abc_instructions.c\
......@@ -122,7 +122,7 @@ $(INTERPRET_LIB): $(OBJ_INTERPRET_LIB) interface.o
$(OBJ_INTERPRET_LIB) interface.o: %.o: %.s
$(AS) $(ASFLAGS) $< -o $@
$(ASM_INTERPRET_LIB): %.s: %.c $(DEP_INTERPRET_LIB) $(DEP_BYTECODE)
$(ASM_INTERPRET_LIB): %.s: %.c $(DEP_INTERPRET_LIB) $(DEP_BCGEN)
$(CC) -DINTERPRETER -DLINK_CLEAN_RUNTIME $(CFLAGS) -S $< -o $@
ifeq ($(OS),Mac)
sed -i '' -f mac_fix_underscores.sed $@
......
......@@ -2,10 +2,11 @@ Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}/optimise
Exec: {Project}/abcopt
CodeGen
CheckStacks: False
CheckIndexes: False
GenerateByteCode: False
Application
HeapSize: 20971520
StackSize: 512000
......
......@@ -2,10 +2,11 @@ Version: 1.4
Global
ProjectRoot: .
Target: StdEnv
Exec: {Project}\optimise.exe
Exec: {Project}\ABCOptimiser.exe
CodeGen
CheckStacks: False
CheckIndexes: True
GenerateByteCode: False
Application
HeapSize: 20971520
StackSize: 512000
......
......@@ -4,7 +4,7 @@
#include <unistd.h>
#include "bcgen_instructions.h"
#include "link.h"
#include "bclink.h"
#include "parse.h"
#include "settings.h"
#include "util.h"
......
......@@ -126,7 +126,7 @@ if [ $BENCHMARK -gt 0 ] && [[ $CFLAGS != *"-Ofast"* ]]; then
sleep 1
fi
CFLAGS="$CFLAGS" make -BC ../src optimise bcgen link interpret || exit 1
CFLAGS="$CFLAGS" make -BC ../src abcopt bcgen bclink interpret || exit 1
$CLM -bytecode -O _system
if [ $RECOMPILE -gt 0 ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment