mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 01:07:34 +02:00
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:
parent
aa70c5ece9
commit
004fa655d5
1 changed files with 20 additions and 14 deletions
|
@ -642,20 +642,26 @@
|
|||
|
||||
;; Helper for the next function
|
||||
(define (inline-prim-call? exp ivars args)
|
||||
(call/cc
|
||||
(lambda (return)
|
||||
;; TODO:
|
||||
;; experimenting with switching inline-ok? with code using data from analysis DB
|
||||
;(trace:error `(inline-ok? ,exp ,ivars ,args))
|
||||
;(inline-ok? exp ivars args (list #f) return)
|
||||
(for-each
|
||||
(lambda (v)
|
||||
(with-var v (lambda (var)
|
||||
(if (not (adbv:inlinable var))
|
||||
(return #f)))))
|
||||
ivars)
|
||||
;; End experimental code
|
||||
(return #t))))
|
||||
(let ((fast-inline #t))
|
||||
;; faster and safer but (at least for now) misses some
|
||||
;; opportunities for optimization because it takes a global
|
||||
;; approach rather than considering the specific variables
|
||||
;; involved for any given optimization.
|
||||
(for-each
|
||||
(lambda (v)
|
||||
(with-var v (lambda (var)
|
||||
(if (not (adbv:inlinable var))
|
||||
(set! fast-inline #f)))))
|
||||
ivars)
|
||||
(if fast-inline
|
||||
;; Fast path, no need for more analysis
|
||||
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
|
||||
;; exp - expression to search
|
||||
|
|
Loading…
Add table
Reference in a new issue