mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
WIP, eliminating more unused lambda's
This commit is contained in:
parent
2fd88a15e6
commit
8ed042573a
1 changed files with 38 additions and 24 deletions
|
@ -1468,7 +1468,20 @@
|
|||
((app? exp)
|
||||
(let ((fn (car exp))
|
||||
(args (map cc (cdr exp))))
|
||||
(if (lambda? fn)
|
||||
(cond
|
||||
((lambda? fn)
|
||||
(cond
|
||||
;; If the lambda argument is not used, flag so the C code is
|
||||
;; all generated within the same function
|
||||
((and (eq? (lambda-formals-type fn) 'args:fixed)
|
||||
(with-var
|
||||
(car (lambda-formals->list fn))
|
||||
(lambda (var)
|
||||
(zero? (adbv:ref-count var)))))
|
||||
`(Cyc-seq
|
||||
,@args
|
||||
,@(map cc (lambda->exp fn))))
|
||||
(else
|
||||
(let* ((body (lambda->exp fn))
|
||||
(new-free-vars
|
||||
(difference
|
||||
|
@ -1490,11 +1503,12 @@
|
|||
; No free vars, just create simple lambda
|
||||
`((lambda ,(lambda->formals fn)
|
||||
,@(map cc body))
|
||||
,@args)))
|
||||
,@args))))))
|
||||
(else
|
||||
(let ((f (cc fn)))
|
||||
`((%closure-ref ,f 0)
|
||||
,f
|
||||
,@args)))))
|
||||
,@args))))))
|
||||
(else
|
||||
(error "unhandled exp: " exp))))
|
||||
(cc exp))
|
||||
|
|
Loading…
Add table
Reference in a new issue