WIP - smarter inline analysis of vector-set

This commit is contained in:
Justin Ethier 2018-11-07 18:08:09 -05:00
parent 62a8110647
commit a12ef15559

View file

@ -582,6 +582,7 @@
;; is what is mutated ;; is what is mutated
(cond (cond
((and (prim:mutates? (car exp)) ((and (prim:mutates? (car exp))
;; loop3-dev WIP step #1 - do not immediately reject these prims
(not (member (car exp) '(vector-set!))) ;; TODO: experimental (not (member (car exp) '(vector-set!))) ;; TODO: experimental
) )
(let ((e (cadr exp))) (let ((e (cadr exp)))
@ -1279,11 +1280,16 @@
(if (not (ref? e)) (if (not (ref? e))
(inline-ok? e ivars args arg-used return))) (inline-ok? e ivars args arg-used return)))
(reverse (cdr exp)))) (reverse (cdr exp))))
TODO: add a new cond here ;; loop3-dev WIP step #2 - some args can be safely ignored
;; TODO: if mutates, can we check to see if there are any "safe" params which we ((and (prim? (car exp))
;; can safely ignore? for example, on vector-set! we know only the vec arg is being mutated, (prim:mutates? (car exp))
;; so ivars in other positions can be ignored (member (car exp) '(vector-set!))
(else )
;; with vector-set, only arg 1 (the vector) is actually mutated
;; TODO: is this always true? do we have problems with self-recursive vecs??
(inline-ok? (cadr exp) ivars args arg-used return)
)
(else
(for-each (for-each
(lambda (e) (lambda (e)
(inline-ok? e ivars args arg-used return)) (inline-ok? e ivars args arg-used return))