mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 12:35:05 +02:00
Added (prim:immutable-args/result? sym)
This commit is contained in:
parent
13c348d419
commit
c3b31e0181
1 changed files with 19 additions and 1 deletions
|
@ -27,7 +27,8 @@
|
||||||
prim:cont?
|
prim:cont?
|
||||||
prim:cont/no-args?
|
prim:cont/no-args?
|
||||||
prim:arg-count?
|
prim:arg-count?
|
||||||
prim:allocates-object?)
|
prim:allocates-object?
|
||||||
|
prim:immutable-args/result?)
|
||||||
(begin
|
(begin
|
||||||
; prim? : exp -> boolean
|
; prim? : exp -> boolean
|
||||||
(define (prim? exp)
|
(define (prim? exp)
|
||||||
|
@ -797,6 +798,23 @@
|
||||||
(define (prim:allocates-object? exp)
|
(define (prim:allocates-object? exp)
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '())))
|
(member exp '())))
|
||||||
|
|
||||||
|
;; Does the primitive only accept/return immutable objects?
|
||||||
|
;; This is useful during optimization, because such primitives
|
||||||
|
;; can always be inlined without concerns for side effects
|
||||||
|
(define (prim:immutable-args/result? sym)
|
||||||
|
(member sym
|
||||||
|
'(= > < >= <=
|
||||||
|
+ - * /
|
||||||
|
Cyc-fast-plus
|
||||||
|
Cyc-fast-sub
|
||||||
|
Cyc-fast-mul
|
||||||
|
Cyc-fast-div
|
||||||
|
Cyc-fast-eq
|
||||||
|
Cyc-fast-gt
|
||||||
|
Cyc-fast-lt
|
||||||
|
Cyc-fast-gte
|
||||||
|
Cyc-fast-lte)))
|
||||||
|
|
||||||
(define (prim:inline-convert-prim-call prim-call)
|
(define (prim:inline-convert-prim-call prim-call)
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Add table
Reference in a new issue