mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-20 14:19:17 +02:00
Bug fixes, enable call graph analysis
This commit is contained in:
parent
0a47e9eaca
commit
6be26698c1
2 changed files with 7 additions and 2 deletions
|
@ -32,7 +32,9 @@
|
||||||
|
|
||||||
;; Is it OK to inline code replacing ref, based on call graph data from lookup table?
|
;; Is it OK to inline code replacing ref, based on call graph data from lookup table?
|
||||||
(define (inline-ok-from-call-graph? ref tbl)
|
(define (inline-ok-from-call-graph? ref tbl)
|
||||||
(and-let* ((vars (hash-table-ref/default tbl ref #f)))
|
(and-let* ((vars (hash-table-ref/default tbl ref #f))
|
||||||
|
((pair? vars))
|
||||||
|
)
|
||||||
(call/cc
|
(call/cc
|
||||||
(lambda (return)
|
(lambda (return)
|
||||||
(for-each
|
(for-each
|
||||||
|
|
|
@ -1004,6 +1004,9 @@
|
||||||
(not (null? (adbv:ref-by var)))
|
(not (null? (adbv:ref-by var)))
|
||||||
;; Need to keep variable because it is mutated
|
;; Need to keep variable because it is mutated
|
||||||
(not (adbv:reassigned? var))
|
(not (adbv:reassigned? var))
|
||||||
|
|
||||||
|
;; Make sure param is not computed by vars that may be mutated
|
||||||
|
(inline-ok-from-call-graph? param *adb-call-graph*)
|
||||||
))))
|
))))
|
||||||
(ast:lambda-formals->list (car exp)))
|
(ast:lambda-formals->list (car exp)))
|
||||||
;; Check all args are valid primitives that can be inlined
|
;; Check all args are valid primitives that can be inlined
|
||||||
|
@ -1602,7 +1605,7 @@
|
||||||
(analyze exp -1 -1) ;; Top-level is lambda ID -1
|
(analyze exp -1 -1) ;; Top-level is lambda ID -1
|
||||||
(analyze2 exp) ;; Second pass
|
(analyze2 exp) ;; Second pass
|
||||||
(analyze:find-inlinable-vars exp '()) ;; Identify variables safe to inline
|
(analyze:find-inlinable-vars exp '()) ;; Identify variables safe to inline
|
||||||
;(set! *adb-call-graph* (analyze:build-call-graph exp))
|
(set! *adb-call-graph* (analyze:build-call-graph exp))
|
||||||
(analyze:find-recursive-calls2 exp)
|
(analyze:find-recursive-calls2 exp)
|
||||||
;(analyze:set-calls-self)
|
;(analyze:set-calls-self)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue