mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 01:07:34 +02:00
Issue #293 - Do not inline if any mutated prim args
As a first cut, do not inline a prim call if any of its arguments has been mutated by a (set!). This is too restrictive but a decent starting point.
This commit is contained in:
parent
43c39abc8a
commit
02b884bf32
1 changed files with 11 additions and 7 deletions
|
@ -1193,16 +1193,20 @@
|
|||
;
|
||||
; TODO: this one is experimental, not sure if it really helps at all. still,
|
||||
; there may well be cases where inlining the var being mutated will cause problems!
|
||||
;(for-each
|
||||
; (lambda (v)
|
||||
; (with-var v (lambda (var)
|
||||
; (if (adbv:cannot-inline var)
|
||||
; (set! cannot-inline #t)))))
|
||||
; args)
|
||||
(for-each
|
||||
(lambda (v)
|
||||
(with-var v (lambda (var)
|
||||
(if (member scope-sym (adbv:mutated-indirectly var))
|
||||
(if (adbv:mutated-by-set? var)
|
||||
(set! cannot-inline #t)))))
|
||||
args)
|
||||
(for-each
|
||||
(lambda (v)
|
||||
(with-var v (lambda (var)
|
||||
(if (or (member scope-sym (adbv:mutated-indirectly var))
|
||||
(adbv:mutated-by-set? var)) ;; TOO restrictive, only matters if set! occurs in body we
|
||||
;; are inlining to. Also, does not catch cases where the
|
||||
;; var might be mutated by a function call outside this
|
||||
;; module (but hopefully we already catch that elsewhere).
|
||||
(set! cannot-inline #t))
|
||||
(if (not (adbv:inlinable var))
|
||||
(set! fast-inline #f)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue