forked from coalton-lang/coalton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.lisp
71 lines (54 loc) · 2.51 KB
/
settings.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;;;; settings.lisp
;;;;
;;;; This file contains variables that can be used to control how
;;;; Coalton works.
(defpackage #:coalton-impl/settings
(:use #:cl)
(:export
#:coalton-release-p ; FUNCTION
#:*coalton-disable-specialization* ; VARIABLE
#:*coalton-print-unicode* ; VARIABLE
#:*coalton-dump-ast* ; VARIABLE
#:*coalton-skip-update* ; VARIABLE
#:*emit-type-annotations* ; VARIABLE
#:*coalton-stage-1-complete* ; VARIABLE
#:*coalton-optimize* ; VARIABLE
#:*coalton-optimize-library* ; VARIABLE
))
(in-package #:coalton-impl/settings)
(declaim (type boolean *coalton-print-unicode*))
(defvar *coalton-print-unicode* t
"Whether to print coalton info using unicode symbols")
(defun coalton-release-p ()
"Determines how redefinable code generated by Coalton is.
In development mode (i.e. (not (coalton-release-p))), Coalton turns all declare-type forms into CLOS objects
to support a repl based workflow.
In release mode Coalton compiles declare-type forms into frozen structs or even more optimal layouts which may
not support redefinition.
Development mode is the default.
Enable release mode either by setting the UNIX environment variable COALTON_ENV to \"release\", or by pushing
`:coalton-release' into `*features*'. Either of these must be done before loading Coalton.
"
(uiop:featurep :coalton-release))
(when (string-equal (uiop:getenv "COALTON_ENV") "release")
(pushnew :coalton-release *features*))
(when (coalton-release-p)
(format t "~&;; COALTON starting in release mode~%"))
(declaim (type boolean *coalton-disable-specialization*))
(defvar *coalton-disable-specialization* nil)
(when (find (uiop:getenv "COALTON_DISABLE_SPECIALIZATION")
'("t" "true" "1")
:test #'string-equal)
(format t "~&;; COALTON starting with specializations disabled")
(setf *coalton-disable-specialization* t))
;; Configure the backend to print out the ast of toplevel forms
(declaim (type boolean *coalton-dump-ast*))
(defvar *coalton-dump-ast* nil)
;; Configure the backend to remove env updates from the generated code
(declaim (type boolean *coalton-skip-update*))
(defvar *coalton-skip-update* nil)
;; Configure the backend to remove type annotations from the generated code
(declaim (type boolean *emit-type-annotations*))
(defvar *emit-type-annotations* t)
(defvar *coalton-optimize* '(optimize (speed 3) (safety 0)))
(defvar *coalton-optimize-library* '(optimize (speed 3) (safety 1)))