Issue #153 - Added -CP -CE -CL command options

This commit is contained in:
Justin Ethier 2017-02-07 20:34:42 +00:00
parent 1f8fb3c20d
commit ff94b013ab
2 changed files with 37 additions and 5 deletions

View file

@ -14,6 +14,20 @@ Features
> >
> Prepend directory to the list of directories that are searched in order to locate imported libraries. > Prepend directory to the list of directories that are searched in order to locate imported libraries.
- Added the `-CP`, `-CE`, and `-CL` compiler options to allow passing arbitrary flags to the C compiler:
> `-CP directory`
>
> Specify a custom command line for the C compiler to compile a program module. See Makefile.config for an example of how to construct such a command line.
>
> `-CE directory`
>
> Specify a custom command line for the C compiler to compile an executable.
>
> `-CL directory`
>
> Specify a custom command line for the C compiler to compile a library module.
- Updated the garbage collector to enhance performance for programs with a high allocation rate, and to scale better to multiple concurrent threads. - Updated the garbage collector to enhance performance for programs with a high allocation rate, and to scale better to multiple concurrent threads.
- Improved error handling by `display` and `write`. - Improved error handling by `display` and `write`.
- Removed the `make_int` C macro which was deprecated and could cause problems when used in FFI functions. - Removed the `make_int` C macro which was deprecated and could cause problems when used in FFI functions.

View file

@ -338,7 +338,7 @@
(read-all port)))) (read-all port))))
;; Compile and emit: ;; Compile and emit:
(define (run-compiler args cc? append-dirs prepend-dirs) (define (run-compiler args cc? cc-prog cc-exec cc-lib append-dirs prepend-dirs)
(let* ((in-file (car args)) (let* ((in-file (car args))
(expander (base-expander)) (expander (base-expander))
(in-prog-raw (read-file in-file)) (in-prog-raw (read-file in-file))
@ -359,6 +359,11 @@
(exec-file (basename in-file)) (exec-file (basename in-file))
(src-file (string-append exec-file ".c")) (src-file (string-append exec-file ".c"))
(meta-file (string-append exec-file ".meta")) (meta-file (string-append exec-file ".meta"))
(get-comp-env
(lambda (sym str)
(if (> (string-length str) 0)
str
(Cyc-compilation-environment sym))))
(create-c-file (create-c-file
(lambda (program) (lambda (program)
(with-output-to-file (with-output-to-file
@ -381,14 +386,16 @@
(comp-prog-cmd (comp-prog-cmd
(string-replace-all (string-replace-all
(string-replace-all (string-replace-all
(Cyc-compilation-environment 'cc-prog) ;(Cyc-compilation-environment 'cc-prog)
(get-comp-env 'cc-prog cc-prog)
"~src-file~" src-file) "~src-file~" src-file)
"~exec-file~" exec-file)) "~exec-file~" exec-file))
(comp-objs-cmd (comp-objs-cmd
(string-replace-all (string-replace-all
(string-replace-all (string-replace-all
(string-replace-all (string-replace-all
(Cyc-compilation-environment 'cc-exec) ;(Cyc-compilation-environment 'cc-exec)
(get-comp-env 'cc-exec cc-exec)
"~exec-file~" exec-file) "~exec-file~" exec-file)
"~obj-files~" objs-str) "~obj-files~" objs-str)
"~exec-file~" exec-file))) "~exec-file~" exec-file)))
@ -415,7 +422,8 @@
(let ((comp-lib-cmd (let ((comp-lib-cmd
(string-replace-all (string-replace-all
(string-replace-all (string-replace-all
(Cyc-compilation-environment 'cc-lib) ;(Cyc-compilation-environment 'cc-lib)
(get-comp-env 'cc-lib cc-lib)
"~src-file~" src-file) "~src-file~" src-file)
"~exec-file~" exec-file))) "~exec-file~" exec-file)))
(cond (cond
@ -456,6 +464,9 @@
; (equal? #\- (string-ref arg 0))))) ; (equal? #\- (string-ref arg 0)))))
; args)) ; args))
(compile? #t) (compile? #t)
(cc-prog (apply string-append (collect-opt-values args "-CP")))
(cc-exec (apply string-append (collect-opt-values args "-CE")))
(cc-lib (apply string-append (collect-opt-values args "-CL")))
(append-dirs (collect-opt-values args "-A")) (append-dirs (collect-opt-values args "-A"))
(prepend-dirs (collect-opt-values args "-I"))) (prepend-dirs (collect-opt-values args "-I")))
;; Set optimization level(s) ;; Set optimization level(s)
@ -475,6 +486,13 @@
in order to locate imported libraries. in order to locate imported libraries.
-I directory Prepend directory to the list of directories that are searched -I directory Prepend directory to the list of directories that are searched
in order to locate imported libraries. in order to locate imported libraries.
-CP directory Specify a custom command line for the C compiler to compile
a program module. See Makefile.config for an example of how
to construct such a command line.
-CE directory Specify a custom command line for the C compiler to compile
an executable.
-CL directory Specify a custom command line for the C compiler to compile
a library module.
-Ox Optimization level, higher means more optimizations will -Ox Optimization level, higher means more optimizations will
be used. Set to 0 to disable optimizations. be used. Set to 0 to disable optimizations.
-d Only generate intermediate C files, do not compile them -d Only generate intermediate C files, do not compile them
@ -497,5 +515,5 @@
(display "cyclone: no input file") (display "cyclone: no input file")
(newline)) (newline))
(else (else
(run-compiler non-opts compile? append-dirs prepend-dirs)))) (run-compiler non-opts compile? cc-prog cc-exec cc-lib append-dirs prepend-dirs))))