Allow inlines if a var is passed to a continuation

This commit is contained in:
Justin Ethier 2017-05-04 08:22:01 +00:00
parent 72c1bb9bea
commit 93f87ac4c3

View file

@ -1081,6 +1081,7 @@
((and (not (prim? (car exp)))
(ref? (car exp)))
(define pure-fnc #f)
(define calling-cont #f)
(define ref-formals '())
;; Does ref refer to a pure function (no side effects)?
(let ((var (adb:get/default (car exp) #f)))
@ -1096,6 +1097,10 @@
(with-fnc! (ast:lambda-id assigned-val) (lambda (fnc)
(if (not (adbf:side-effects fnc))
(set! pure-fnc #t)))))
;; Experimental - if a cont, execution will leave fnc anyway,
;; so inlines there should be safe
((adbv:cont? var)
(set! calling-cont #t))
))))
;;
(with-var (car exp) (lambda (var)
@ -1110,7 +1115,7 @@
))))
;(trace:error `(DEBUG ref app ,(car exp) ,(cdr exp) ,ref-formals))
(cond
(pure-fnc
((or pure-fnc calling-cont)
(for-each
(lambda (e)
;; Skip refs since fnc is pure and cannot change them