WIP for proof of concept

This commit is contained in:
Justin Ethier 2019-02-14 13:23:20 -05:00
parent 12b6131992
commit 0604fdf221

View file

@ -433,23 +433,25 @@
(trace:info "---------------- after CPS:") (trace:info "---------------- after CPS:")
(trace:info (ast:ast->pp-sexp input-program)) (trace:info (ast:ast->pp-sexp input-program))
;(define
; *cps-opt-options*
; (list
; (cons 'module-globals module-globals)
; ;(cons)
; ))
;TODO: use this function to set module-globals and globals, then pass it instead of options above
(define (inject-globals! lis) (define (inject-globals! lis)
;; TODO: done here as proof-of-concept
(let ((dep (lib:list->import-set '(srfi 69))))
(when (not (member dep lib-deps))
(set! globals (append globals '(Cyc-memoize)))
(set! imported-vars (cons (lib:list->import-set '(Cyc-memoize srfi 69)) imported-vars))
(set! lib-deps (cons dep lib-deps))
(change-lib-deps! lib-deps)))
(set! module-globals (append module-globals lis)) (set! module-globals (append module-globals lis))
(set! globals (append globals lis)) (set! globals (append globals lis))
(set! globals (union globals '())) ;; Ensure list is sorted (set! globals (union globals '())) ;; Ensure list is sorted
) )
;TODO: pass this function to check flags, instead of having search logic in CPS opt module
(define (flag-set? flag) (define (flag-set? flag)
(cond (cond
((eq? flag 'memoize-pure-functions) ((eq? flag 'memoize-pure-functions)
#t) #t) ;; TODO: read this in from command line
;; TODO: probably will need to disable this for libraries, since srfi-69 dep would need to be carried around otherwise
(else #f))) (else #f)))
(when (> *optimization-level* 0) (when (> *optimization-level* 0)