Clean up old comments and dead code

This commit is contained in:
Justin Ethier 2019-10-08 17:49:40 -04:00
parent f4c8326c78
commit 900605f1fe

View file

@ -28,7 +28,7 @@
; Placeholder for future enhancement to show elapsed time by phase: ; Placeholder for future enhancement to show elapsed time by phase:
(define *start* (current-second)) (define *start* (current-second))
;; TODO: make this a cmd line option ;; FUTURE: make this a cmd line option
(define *report-elapsed* #f) (define *report-elapsed* #f)
(define (report:elapsed label) (define (report:elapsed label)
(when *report-elapsed* (when *report-elapsed*
@ -61,7 +61,7 @@
(report:elapsed "---------------- input program:") (report:elapsed "---------------- input program:")
(trace:info "---------------- input program:") (trace:info "---------------- input program:")
(trace:info input-program) ;pretty-print (trace:info input-program)
(cond (cond
((library? (car input-program)) ((library? (car input-program))
@ -184,19 +184,16 @@
(error `(Unhandled expansion ,expanded)))))))) (error `(Unhandled expansion ,expanded))))))))
(report:elapsed "---------------- after macro expansion:") (report:elapsed "---------------- after macro expansion:")
(trace:info "---------------- after macro expansion:") (trace:info "---------------- after macro expansion:")
(trace:info input-program) ;pretty-print (trace:info input-program)
; TODO:
(set! input-program (macro:cleanup input-program rename-env)) (set! input-program (macro:cleanup input-program rename-env))
(report:elapsed "---------------- after macro expansion cleanup:") (report:elapsed "---------------- after macro expansion cleanup:")
(trace:info "---------------- after macro expansion cleanup:") (trace:info "---------------- after macro expansion cleanup:")
(trace:info input-program) ;pretty-print (trace:info input-program)
;; If a program, check to see if any macros expanded into top-level imports ;; If a program, check to see if any macros expanded into top-level imports
(when program? (when program?
(let ((program:imports/code (import-reduction input-program (base-expander)))) (let ((program:imports/code (import-reduction input-program (base-expander))))
(when (not (null? (car program:imports/code))) (when (not (null? (car program:imports/code)))
;(trace:info "debug")
;(trace:info program:imports/code)
(trace:info "-------------- macro expanded into import expression(s):") (trace:info "-------------- macro expanded into import expression(s):")
(set! imports (append imports (car program:imports/code))) (set! imports (append imports (car program:imports/code)))
(trace:info "imports:") (trace:info "imports:")
@ -238,7 +235,7 @@
(report:elapsed "---------------- after processing globals") (report:elapsed "---------------- after processing globals")
(trace:info "---------------- after processing globals") (trace:info "---------------- after processing globals")
(trace:info input-program) ;pretty-print (trace:info input-program)
;; Identify global variables ;; Identify global variables
(set! module-globals (global-vars input-program)) (set! module-globals (global-vars input-program))
@ -282,8 +279,6 @@
; Note alpha-conversion is overloaded to convert internal defines to ; Note alpha-conversion is overloaded to convert internal defines to
; set!'s below, since all remaining phases operate on set!, not define. ; set!'s below, since all remaining phases operate on set!, not define.
;
; TODO: consider moving some of this alpha-conv logic below back into trans?
(set! globals (union globals '())) ;; Ensure list is sorted (set! globals (union globals '())) ;; Ensure list is sorted
(set! input-program (set! input-program
(map (map
@ -292,7 +287,7 @@
input-program)) input-program))
(report:elapsed "---------------- after alpha conversion:") (report:elapsed "---------------- after alpha conversion:")
(trace:info "---------------- after alpha conversion:") (trace:info "---------------- after alpha conversion:")
(trace:info input-program) ;pretty-print (trace:info input-program)
;; EXPERIMENTAL CODE - Load functions in other modules that are ;; EXPERIMENTAL CODE - Load functions in other modules that are
;; able to be inlined (in this context, from CPS). ;; able to be inlined (in this context, from CPS).
@ -360,7 +355,7 @@
input-program)) input-program))
(report:elapsed "---------------- after func->primitive conversion:") (report:elapsed "---------------- after func->primitive conversion:")
(trace:info "---------------- after func->primitive conversion:") (trace:info "---------------- after func->primitive conversion:")
(trace:info input-program) ;pretty-print (trace:info input-program)
;; Identify native Scheme functions (from module being compiled) that can be inlined ;; Identify native Scheme functions (from module being compiled) that can be inlined
;; ;;
@ -419,8 +414,6 @@
;; (apply k consumer vals))))) ;; (apply k consumer vals)))))
(cons (cons
;; call/cc must be written in CPS form, so it is added here ;; call/cc must be written in CPS form, so it is added here
;; TODO: prevents this from being optimized-out
;; TODO: will this cause issues if another var is assigned to call/cc?
`(define call/cc `(define call/cc
,(ast:make-lambda ,(ast:make-lambda
'(k f) '(k f)
@ -497,7 +490,7 @@
(trace:info "---------------- after local variable reduction") (trace:info "---------------- after local variable reduction")
(trace:info (ast:ast->pp-sexp input-program)) (trace:info (ast:ast->pp-sexp input-program))
;; TODO: could do this, but it seems like a bit of a band-aid... ;; Clean up lambda numbering after code elimination
(set! input-program (opt:renumber-lambdas! input-program)) (set! input-program (opt:renumber-lambdas! input-program))
(report:elapsed "---------------- after renumber lambdas") (report:elapsed "---------------- after renumber lambdas")
(trace:info "---------------- after renumber lambdas") (trace:info "---------------- after renumber lambdas")
@ -630,7 +623,7 @@
(else (else
;; Account for any cond-expand declarations in the library ;; Account for any cond-expand declarations in the library
(list (lib:cond-expand (car in-prog-raw) expander))))) (list (lib:cond-expand (car in-prog-raw) expander)))))
;; TODO: expand in-prog, if a library, using lib:cond-expand. (OK, this works now) ;; expand in-prog, if a library, using lib:cond-expand.
;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library ;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library
(program:imports/code (if program? (import-reduction in-prog expander) '())) (program:imports/code (if program? (import-reduction in-prog expander) '()))
(lib-deps (lib-deps
@ -752,7 +745,7 @@
args))) args)))
;; Handle command line arguments ;; Handle command line arguments
(let* ((args (command-line-arguments)) ;; TODO: port (command-line-arguments) to husk?? (let* ((args (command-line-arguments))
(non-opts (non-opts
(if (null? args) (if (null? args)
'() '()