From 7221fcd8440febc4a178bd2e846cbacc27478fa9 Mon Sep 17 00:00:00 2001 From: Magnus Myreen Date: Mon, 19 Sep 2022 09:50:56 +0200 Subject: [PATCH 1/5] Rename __EVAL__ to EVAL --- basis/basis_ffi.c | 8 ++++---- compiler/backend/exportScript.sml | 4 ++-- compiler/bootstrap/compilation/x64/Makefile | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/basis/basis_ffi.c b/basis/basis_ffi.c index a95321189f..8251ebcaf1 100644 --- a/basis/basis_ffi.c +++ b/basis/basis_ffi.c @@ -8,7 +8,7 @@ #include #include #include -#ifdef __EVAL__ +#ifdef EVAL #include #include #include @@ -36,7 +36,7 @@ extern char cake_text_begin; extern char cake_codebuffer_begin; extern char cake_codebuffer_end; -#ifdef __EVAL__ +#ifdef EVAL /* Signal handler for SIGINT */ @@ -140,7 +140,7 @@ void ffiopen_in (unsigned char *c, long clen, unsigned char *a, long alen) { void ffiopen_out (unsigned char *c, long clen, unsigned char *a, long alen) { assert(9 <= alen); - #ifdef __EVAL__ + #ifdef EVAL int fd = open((const char *) c, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); #else int fd = open((const char *) c, O_RDWR|O_CREAT|O_TRUNC); @@ -379,7 +379,7 @@ int main (int local_argc, char **local_argv) { cml_stack = cml_heap + cml_heap_sz; cml_stackend = cml_stack + cml_stack_sz; - #ifdef __EVAL__ + #ifdef EVAL /** Set up the "eval" code buffer to be read-write-execute. **/ if(mprotect(&cake_text_begin, &cake_codebuffer_end - &cake_text_begin, diff --git a/compiler/backend/exportScript.sml b/compiler/backend/exportScript.sml index 12da7a76dd..f87ac6abea 100644 --- a/compiler/backend/exportScript.sml +++ b/compiler/backend/exportScript.sml @@ -69,7 +69,7 @@ Definition data_buffer_def: MAP (\n. strlit (n ++ "\n")) [" .globl cdecl(cake_bitmaps_buffer_begin)"; "cdecl(cake_bitmaps_buffer_begin):"; - "#if defined(__EVAL__)"; + "#if defined(EVAL)"; " .space DATA_BUFFER_SIZE"; "#endif"; " .globl cdecl(cake_bitmaps_buffer_end)"; @@ -81,7 +81,7 @@ Definition code_buffer_def: MAP (\n. strlit (n ++ "\n")) [" .globl cdecl(cake_codebuffer_begin)"; "cdecl(cake_codebuffer_begin):"; - "#if defined(__EVAL__)"; + "#if defined(EVAL)"; " .space CODE_BUFFER_SIZE"; "#endif"; " .p2align 12"; diff --git a/compiler/bootstrap/compilation/x64/Makefile b/compiler/bootstrap/compilation/x64/Makefile index 375c22cdd5..d1f4761a7e 100644 --- a/compiler/bootstrap/compilation/x64/Makefile +++ b/compiler/bootstrap/compilation/x64/Makefile @@ -17,7 +17,7 @@ ifeq ($(OS),Windows_NT) else PREF = ./ SUFF = - EVALFLAG = -D__EVAL__ + EVALFLAG = -DEVAL endif ifeq ($(OS),Darwin) From f31a0ae437bab11540925f98980a0ca727bb88de Mon Sep 17 00:00:00 2001 From: Magnus Myreen Date: Mon, 19 Sep 2022 09:53:24 +0200 Subject: [PATCH 2/5] Attempt to speed up builds with a bit of rearranging --- developers/build-sequence | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/developers/build-sequence b/developers/build-sequence index d82344d636..a86ef251bd 100644 --- a/developers/build-sequence +++ b/developers/build-sequence @@ -4,6 +4,10 @@ developers developers/bin +# build many things in parallel at the start +compiler/proofs +compiler/bootstrap/translation + # semantics and metatheory semantics/ffi semantics @@ -66,7 +70,6 @@ compiler/backend/arm8_asl compiler/backend/mips/proofs compiler/backend/riscv/proofs compiler/backend/ag32/proofs -compiler/proofs # candle candle/set-theory @@ -130,7 +133,6 @@ icing/examples # compiler translation compiler/repl -compiler/bootstrap/translation # compiler sexpr bootstrap unverified/sexpr-bootstrap/x64/64:cake-unverified-x64-64.tar.gz From fe60f122ca62e59b367bbc603b71d88c0b93e191 Mon Sep 17 00:00:00 2001 From: Magnus Myreen Date: Mon, 19 Sep 2022 09:58:34 +0200 Subject: [PATCH 3/5] Add a sample source file hello.cml to compiler gz --- compiler/bootstrap/compilation/x64/32/Holmakefile | 4 ++-- compiler/bootstrap/compilation/x64/32/hello.cml | 1 + compiler/bootstrap/compilation/x64/64/Holmakefile | 4 ++-- compiler/bootstrap/compilation/x64/64/hello.cml | 1 + compiler/bootstrap/compilation/x64/hello.cml | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) create mode 120000 compiler/bootstrap/compilation/x64/32/hello.cml create mode 120000 compiler/bootstrap/compilation/x64/64/hello.cml create mode 100644 compiler/bootstrap/compilation/x64/hello.cml diff --git a/compiler/bootstrap/compilation/x64/32/Holmakefile b/compiler/bootstrap/compilation/x64/32/Holmakefile index 9467bd169f..161c78f6b9 100644 --- a/compiler/bootstrap/compilation/x64/32/Holmakefile +++ b/compiler/bootstrap/compilation/x64/32/Holmakefile @@ -14,7 +14,7 @@ README.md: $(CAKEMLDIR)/developers/readme_gen readmePrefix $(patsubst %,%readmeP cake.S: *$(ARCH)BootstrapScript.sml -cake-$(ARCH)-$(WORD_SIZE).tar.gz: cake.S basis_ffi.c Makefile how-to.md - tar -chzf $@ --transform='s|^|cake-$(ARCH)-$(WORD_SIZE)/|' cake.S basis_ffi.c Makefile how-to.md +cake-$(ARCH)-$(WORD_SIZE).tar.gz: cake.S basis_ffi.c Makefile hello.cml how-to.md + tar -chzf $@ --transform='s|^|cake-$(ARCH)-$(WORD_SIZE)/|' cake.S basis_ffi.c Makefile hello.cml how-to.md EXTRA_CLEANS = cake.S cake-$(ARCH)-$(WORD_SIZE).tar.gz diff --git a/compiler/bootstrap/compilation/x64/32/hello.cml b/compiler/bootstrap/compilation/x64/32/hello.cml new file mode 120000 index 0000000000..281e518da0 --- /dev/null +++ b/compiler/bootstrap/compilation/x64/32/hello.cml @@ -0,0 +1 @@ +../hello.cml \ No newline at end of file diff --git a/compiler/bootstrap/compilation/x64/64/Holmakefile b/compiler/bootstrap/compilation/x64/64/Holmakefile index 5e765cc000..8ab472bff8 100644 --- a/compiler/bootstrap/compilation/x64/64/Holmakefile +++ b/compiler/bootstrap/compilation/x64/64/Holmakefile @@ -18,8 +18,8 @@ config_enc_str.txt: *$(ARCH)_config_encScript.sml cake-sexpr-32: *sexprBootstrap32Script.sml cake-sexpr-64: *sexprBootstrap64Script.sml -cake-$(ARCH)-$(WORD_SIZE).tar.gz: cake.S basis_ffi.c Makefile how-to.md cake-sexpr-32 cake-sexpr-64 config_enc_str.txt candle_boot.ml repl_boot.cml - tar -chzf $@ --transform='s|^|cake-$(ARCH)-$(WORD_SIZE)/|' cake.S basis_ffi.c Makefile how-to.md cake-sexpr-32 cake-sexpr-64 config_enc_str.txt candle_boot.ml repl_boot.cml +cake-$(ARCH)-$(WORD_SIZE).tar.gz: cake.S basis_ffi.c Makefile hello.cml how-to.md cake-sexpr-32 cake-sexpr-64 config_enc_str.txt candle_boot.ml repl_boot.cml + tar -chzf $@ --transform='s|^|cake-$(ARCH)-$(WORD_SIZE)/|' cake.S basis_ffi.c Makefile hello.cml how-to.md cake-sexpr-32 cake-sexpr-64 config_enc_str.txt candle_boot.ml repl_boot.cml make test-hello.cake # the following lines are a basic test ./test-hello.cake >output echo 'Hello!'>expected_output diff --git a/compiler/bootstrap/compilation/x64/64/hello.cml b/compiler/bootstrap/compilation/x64/64/hello.cml new file mode 120000 index 0000000000..281e518da0 --- /dev/null +++ b/compiler/bootstrap/compilation/x64/64/hello.cml @@ -0,0 +1 @@ +../hello.cml \ No newline at end of file diff --git a/compiler/bootstrap/compilation/x64/hello.cml b/compiler/bootstrap/compilation/x64/hello.cml new file mode 100644 index 0000000000..9074bbcd19 --- /dev/null +++ b/compiler/bootstrap/compilation/x64/hello.cml @@ -0,0 +1 @@ +print "Hello, World!\n"; From 57e4c33190bf5dceb77f15d4c97d5016786d1f9e Mon Sep 17 00:00:00 2001 From: Magnus Myreen Date: Mon, 19 Sep 2022 10:17:22 +0200 Subject: [PATCH 4/5] Add mandatory comment --- compiler/bootstrap/compilation/x64/hello.cml | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/bootstrap/compilation/x64/hello.cml b/compiler/bootstrap/compilation/x64/hello.cml index 9074bbcd19..967972809e 100644 --- a/compiler/bootstrap/compilation/x64/hello.cml +++ b/compiler/bootstrap/compilation/x64/hello.cml @@ -1 +1,2 @@ +(* A simple hello world program in CakeML *) print "Hello, World!\n"; From a69ce9eb8ce0a1e431f74b6c627bf4b37f65a902 Mon Sep 17 00:00:00 2001 From: Magnus Myreen Date: Wed, 21 Sep 2022 16:03:53 +0200 Subject: [PATCH 5/5] Adjust comment to make readme_gen happy --- compiler/bootstrap/compilation/x64/hello.cml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/bootstrap/compilation/x64/hello.cml b/compiler/bootstrap/compilation/x64/hello.cml index 967972809e..8e079d8fdc 100644 --- a/compiler/bootstrap/compilation/x64/hello.cml +++ b/compiler/bootstrap/compilation/x64/hello.cml @@ -1,2 +1,4 @@ -(* A simple hello world program in CakeML *) +(* + A simple hello world program in CakeML +*) print "Hello, World!\n";