mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
Issue #449 - Selectively disable optimizations
Memoize optimizations are not compatible with top-level define-c forms, so for now we disable these optimizations in this situation.
This commit is contained in:
parent
209050b2d4
commit
d874c05266
1 changed files with 47 additions and 35 deletions
|
@ -168,6 +168,20 @@
|
||||||
(map scan exp))
|
(map scan exp))
|
||||||
(else exp)
|
(else exp)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
;; Does given sexp contain any top-level define-c expressions?
|
||||||
|
(define (has-define-c? sexp)
|
||||||
|
(call/cc
|
||||||
|
(lambda (k)
|
||||||
|
(for-each
|
||||||
|
(lambda (exp)
|
||||||
|
(if (define-c? exp)
|
||||||
|
(k #t)))
|
||||||
|
sexp)
|
||||||
|
(k #f))))
|
||||||
|
|
||||||
|
(if (has-define-c? sexp)
|
||||||
|
sexp ;; Can't optimize with define-c (yet), so bail
|
||||||
(let ((new-exp (scan sexp)))
|
(let ((new-exp (scan sexp)))
|
||||||
(cond
|
(cond
|
||||||
((not (null? memo-tbl))
|
((not (null? memo-tbl))
|
||||||
|
@ -201,9 +215,7 @@
|
||||||
memo-tbl)
|
memo-tbl)
|
||||||
)))
|
)))
|
||||||
new-exp)))
|
new-exp)))
|
||||||
(else new-exp)))
|
(else new-exp)))))
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
(cond-expand
|
(cond-expand
|
||||||
(program
|
(program
|
||||||
|
|
Loading…
Add table
Reference in a new issue