Experimental inline change

At least for now, use both inlinable analysis (fast path) and inline-ok (slow path, but finds more optimizations).
This commit is contained in:
Justin Ethier 2016-11-10 20:59:38 +00:00
parent aa70c5ece9
commit 004fa655d5

View file

@ -642,20 +642,26 @@
;; Helper for the next function ;; Helper for the next function
(define (inline-prim-call? exp ivars args) (define (inline-prim-call? exp ivars args)
(call/cc (let ((fast-inline #t))
(lambda (return) ;; faster and safer but (at least for now) misses some
;; TODO: ;; opportunities for optimization because it takes a global
;; experimenting with switching inline-ok? with code using data from analysis DB ;; approach rather than considering the specific variables
;(trace:error `(inline-ok? ,exp ,ivars ,args)) ;; involved for any given optimization.
;(inline-ok? exp ivars args (list #f) return) (for-each
(for-each (lambda (v)
(lambda (v) (with-var v (lambda (var)
(with-var v (lambda (var) (if (not (adbv:inlinable var))
(if (not (adbv:inlinable var)) (set! fast-inline #f)))))
(return #f))))) ivars)
ivars) (if fast-inline
;; End experimental code ;; Fast path, no need for more analysis
(return #t)))) fast-inline
;; Fast path failed, see if we can inline anyway
(call/cc
(lambda (return)
;(trace:error `(inline-ok? ,exp ,ivars ,args))
(inline-ok? exp ivars args (list #f) return)
(return #t))))))
;; Make sure inlining a primitive call will not cause out-of-order execution ;; Make sure inlining a primitive call will not cause out-of-order execution
;; exp - expression to search ;; exp - expression to search