mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 07:17:37 +02:00
Precompute application of a primitive to literals
Precompute primitives when it is safe to do so
This commit is contained in:
parent
7f82bf2617
commit
a5c1d01653
1 changed files with 6 additions and 6 deletions
12
trans.scm
12
trans.scm
|
@ -772,6 +772,9 @@
|
||||||
cell
|
cell
|
||||||
set-car!
|
set-car!
|
||||||
set-cdr!
|
set-cdr!
|
||||||
|
string->symbol ;; Could be mistaken for an identifier
|
||||||
|
string->list ;; Mistaken for function call (maybe OK if it was quoted, though). same for above?
|
||||||
|
;; I/O must be done at runtime for side effects:
|
||||||
current-input-port
|
current-input-port
|
||||||
open-input-file
|
open-input-file
|
||||||
close-input-port
|
close-input-port
|
||||||
|
@ -1433,12 +1436,9 @@
|
||||||
(cons (car ast)
|
(cons (car ast)
|
||||||
(map (lambda (a) (convert a renamed))
|
(map (lambda (a) (convert a renamed))
|
||||||
(cdr ast)))))
|
(cdr ast)))))
|
||||||
;; TODO: want to enable this, but requires adding stuff to the
|
(if (precompute-prim-app? converted)
|
||||||
;; runtime, such as floating point numbers
|
(eval converted) ;; OK, evaluate at compile time
|
||||||
;;
|
converted)))
|
||||||
;(if (precompute-prim-app? converted)
|
|
||||||
; (eval converted) ;; Evaluate now, if possible
|
|
||||||
converted));)
|
|
||||||
((lambda? ast)
|
((lambda? ast)
|
||||||
(let* ((args (lambda-formals->list ast))
|
(let* ((args (lambda-formals->list ast))
|
||||||
(ltype (lambda-formals-type ast))
|
(ltype (lambda-formals-type ast))
|
||||||
|
|
Loading…
Add table
Reference in a new issue