1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 06:20:23 +02:00

Enable prompt analysis

* module/language/cps/dfg.scm (compute-live-variables, visit-fun):
  Use the new prompt analysis pass in analyze-control-flow instead of
  always adding a link in the DFG.  Avoids problems if there are
  parts of the prompt body that have no path to the pop.
This commit is contained in:
Andy Wingo 2014-01-09 19:23:03 +01:00
parent 9002277d0f
commit 146ce52d21

View file

@ -708,7 +708,8 @@ BODY for each body continuation in the prompt."
(values mapping n)))
(call-with-values (lambda () (make-variable-mapping (dfg-use-maps dfg)))
(lambda (var-map nvars)
(let* ((cfa (analyze-control-flow fun dfg #:reverse? #t))
(let* ((cfa (analyze-control-flow fun dfg #:reverse? #t
#:add-handler-preds? #t))
(syms (make-vector nvars #f))
(names (make-vector nvars #f))
(usev (make-vector (cfa-k-count cfa) '()))
@ -846,18 +847,7 @@ BODY for each body continuation in the prompt."
(($ $prompt escape? tag handler pop)
(use! tag)
(use-k! handler)
;; Any continuation in the prompt body could cause an abort to
;; the handler, so in theory we could register the handler as
;; a successor of any block in the prompt body. That would be
;; inefficient, though, besides being a hack. Instead we take
;; advantage of the fact that pop continuation post-dominates
;; the prompt body, so we add a link from there to the
;; handler. This creates a primcall node with multiple
;; successors, which is not quite correct, but it does reflect
;; control flow. It is necessary to ensure that the live
;; variables in the handler are seen as live in the body.
(link-blocks! pop handler))
(use-k! handler))
(($ $fun)
(when global?