mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +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)))))
|
(equal? 'args:fixed (lambda-formals-type (car (define->exp expr)))))
|
||||||
(call/cc
|
(call/cc
|
||||||
(lambda (k)
|
(lambda (k)
|
||||||
(scan
|
(let* ((define-body (car (define->exp expr)))
|
||||||
(car (lambda->exp
|
(lambda-body (lambda->exp define-body)))
|
||||||
(car (define->exp expr))))
|
(cond
|
||||||
(lambda () (k #f))) ;; Fail with #f
|
((> (length lambda-body) 1)
|
||||||
(k #t)))) ;; Scanned fine, return #t
|
(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)))
|
(else #f)))
|
||||||
;;
|
;;
|
||||||
;; Helpers to syntax check primitive calls
|
;; Helpers to syntax check primitive calls
|
||||||
|
|
Loading…
Add table
Reference in a new issue