~ chicken-core (chicken-5) 4bc98d31d3cb78ab55d1df923fa8b1c71f7ca1a4
commit 4bc98d31d3cb78ab55d1df923fa8b1c71f7ca1a4 Author: megane <meganeka@gmail.com> AuthorDate: Sun Oct 13 16:26:25 2019 +0300 Commit: megane <meganeka@gmail.com> CommitDate: Sun Oct 13 18:15:31 2019 +0300 * optimizer.scm (within-unrolling-limit): Add note about performance + tweak comments diff --git a/optimizer.scm b/optimizer.scm index 3e84ce53..7d9d773c 100644 --- a/optimizer.scm +++ b/optimizer.scm @@ -150,7 +150,7 @@ (define simplifications (make-vector 301 '())) (define simplified-ops '()) (define broken-constant-nodes '()) -;; holds a-list mapping inlined fid's to inline-target-fid for catching runaway +;; Holds a-list mapping inlined fid's to inline-target-fid for catching runaway ;; unrolling: (define inline-history '()) @@ -419,7 +419,7 @@ (let ((n2 (inline-lambda-bindings llist args (first (node-subexpressions lval)) #t db cfk))) - (set! inline-history + (set! inline-history (alist-cons ifid (car fids) inline-history)) (touch) (walk n2 fids gae))))) @@ -578,8 +578,11 @@ ;; Check whether inlined procedure has already been inlined in the -;; same target procedure and count occurrences. If the number of -;; inlinings exceed the unroll-limit +;; same target procedure and count occurrences. +;; +;; Note: This check takes O(n) time, where n is the total number of +;; performed inlines. This can be optimized to O(1) if high number of +;; inlines starts to slow down the compilation. (define (within-unrolling-limit fid tfid max-unrolls) (let ((p (cons fid tfid)))Trap