Experimental change to only emit assignments for used args

Having other compilation issues but want to get this checked in since we need this functionality
This commit is contained in:
Justin Ethier 2021-03-13 22:54:39 -05:00
parent 1e91243b16
commit b6c5a9007a

View file

@ -1824,6 +1824,7 @@
(cps? (cps?
(let ((i 0) (let ((i 0)
(cstr "") (cstr "")
;;;(scm-args (ast:lambda-formals->list exp))
(args formals-as-list)) (args formals-as-list))
;; Strip off extra varargs since we will load them ;; Strip off extra varargs since we will load them
;; up using a different technique ;; up using a different technique
@ -1834,14 +1835,22 @@
;; Generate code to unpack args into locals w/expected names ;; Generate code to unpack args into locals w/expected names
(for-each (for-each
(lambda (arg) (lambda (arg)
;;;(lambda (scm-arg arg)
;;;(trace:error `(DEBUG ,scm-arg ARG ,arg))
;;;(let ((var (adb:get scm-arg)))
;;; (when (and (> (adbv:ref-count var) 0)
;;; (not (null? (adbv:ref-by var))))
(set! cstr (string-append (set! cstr (string-append
cstr cstr
arg arg
" = args[" " = args["
(number->string i) (number->string i)
"];" "];"
)) ) ;))
(set! i (+ i 1))) (set! i (+ i 1)))
;;;(if has-closure?
;;; (cdr scm-args)
;;; scm-args))
(if has-closure? (if has-closure?
(cdr args) (cdr args)
args)) args))