mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Do not try to inline large lambda bodies
If a lambda body contains more than one expression it must be compiled using CPS, so the inline code must reject it as a possible candidate.
This commit is contained in:
parent
5bc26c072a
commit
0262beb351
1 changed files with 11 additions and 5 deletions
|
@ -1272,11 +1272,17 @@
|
|||
(equal? 'args:fixed (lambda-formals-type (car (define->exp expr)))))
|
||||
(call/cc
|
||||
(lambda (k)
|
||||
(scan
|
||||
(car (lambda->exp
|
||||
(car (define->exp expr))))
|
||||
(lambda () (k #f))) ;; Fail with #f
|
||||
(k #t)))) ;; Scanned fine, return #t
|
||||
(let* ((define-body (car (define->exp expr)))
|
||||
(lambda-body (lambda->exp define-body)))
|
||||
(cond
|
||||
((> (length lambda-body) 1)
|
||||
(k #f)) ;; Fail with more than one expression in lambda body,
|
||||
;; because CPS is required to compile that.
|
||||
(else
|
||||
(scan
|
||||
(car lambda-body)
|
||||
(lambda () (k #f))) ;; Fail with #f
|
||||
(k #t))))))) ;; Scanned fine, return #t
|
||||
(else #f)))
|
||||
;;
|
||||
;; Helpers to syntax check primitive calls
|
||||
|
|
Loading…
Add table
Reference in a new issue