Added -no-call-history flag

Allow for faster executables at the expense of call history.
This commit is contained in:
Justin Ethier 2019-10-14 13:01:16 -04:00
parent 8cf0745c62
commit e98e35ee5b
3 changed files with 22 additions and 3 deletions

View file

@ -5,6 +5,10 @@
TODO: mention cyclone-winds even though not part of this official release
https://github.com/cyclone-scheme/cyclone-winds
Features
- Added the `-no-call-history` flag to potentially allow for faster executables at the expense of call history.
Bug Fixes
- Fix `read-u8`, `peek-u8`, and `write-u8` to work with integers (bytes) instead of characters.

View file

@ -25,6 +25,7 @@
(define *optimization-level* 2) ;; Default level
(define *optimize:memoize-pure-functions* #t) ;; Memoize pure funcs by default
(define *cgen:track-call-history* #t)
; Placeholder for future enhancement to show elapsed time by phase:
(define *start* (current-second))
@ -463,6 +464,8 @@
((eq? flag 'memoize-pure-functions)
(and program? ;; Only for programs, because SRFI 69 becomes a new dep
*optimize:memoize-pure-functions*))
((eq? flag 'track-call-history)
*cgen:track-call-history*)
(else #f)))
(when (> *optimization-level* 0)
@ -553,7 +556,8 @@
module-globals
c-headers
lib-deps
src-file)
src-file
flag-set?)
(return '())))) ;; No codes to return
;; Read top-level imports from a program and return a cons of:
@ -769,6 +773,8 @@
(set! *optimize:memoize-pure-functions* #t))
(if (member "-no-memoization-optimizations" args)
(set! *optimize:memoize-pure-functions* #f))
(if (member "-no-call-history" args)
(set! *cgen:track-call-history* #f))
;; TODO: place more optimization reading here as necessary
;; End optimizations
(if (member "-t" args)
@ -811,6 +817,11 @@ Optimization options:
where possible (enabled by default).
-no-memoization-optimizations Disable the above memoization optimization.
Debug options
-no-call-history Do not track call history in the compiled code. This
allows for a faster runtime at the cost of having
no call history in the event of an exception.
")
(newline))
((member "-v" args)

View file

@ -40,6 +40,7 @@
st:->var)
(begin
(define *cgen:track-call-history* #t)
(define *optimize-well-known-lambdas* #f)
(define (emit line)
@ -263,7 +264,8 @@
(define (st:->code trace)
(if (or (not (pair? trace))
(null? (cdr trace)))
(null? (cdr trace))
(not *cgen:track-call-history*))
""
(string-append
"Cyc_st_add(data, \""
@ -1848,8 +1850,10 @@
globals
c-headers
required-libs
src-file)
src-file
flag-set?)
(set! *global-syms* (append globals (lib:idb:ids import-db)))
(set! *cgen:track-call-history* (flag-set? 'track-call-history))
(set! num-lambdas (+ (adb:max-lambda-id) 1))
(set! cgen:mangle-global
(lambda (ident)