mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
Add with-fresh-name-state-from-dfg
* module/language/cps/dfg.scm (with-fresh-name-state-from-dfg): New helper. ($dfg, compute-dfg): Store max-var and max-label in the dfg. * module/language/cps.scm (with-fresh-name-state): Don't raise an error on recursive invocation; that was mostly useful when finding a bug. * module/language/cps/arities.scm (fix-arities): * module/language/cps/specialize-primcalls.scm (specialize-primcalls): Use the new helper. * .dir-locals.el: Update.
This commit is contained in:
parent
af11242268
commit
3e1b97c1b0
5 changed files with 25 additions and 15 deletions
|
@ -49,6 +49,7 @@
|
|||
dfg-label-count
|
||||
dfg-min-var
|
||||
dfg-var-count
|
||||
with-fresh-name-state-from-dfg
|
||||
lookup-def
|
||||
lookup-uses
|
||||
lookup-predecessors
|
||||
|
@ -102,7 +103,8 @@
|
|||
;; Data-flow graph for CPS: both for values and continuations.
|
||||
(define-record-type $dfg
|
||||
(make-dfg conts preds defs uses scopes scope-levels
|
||||
min-label label-count min-var var-count)
|
||||
min-label max-label label-count
|
||||
min-var max-var var-count)
|
||||
dfg?
|
||||
;; vector of label -> $kif, $kargs, etc
|
||||
(conts dfg-cont-table)
|
||||
|
@ -118,8 +120,11 @@
|
|||
(scope-levels dfg-scope-levels)
|
||||
|
||||
(min-label dfg-min-label)
|
||||
(max-label dfg-max-label)
|
||||
(label-count dfg-label-count)
|
||||
|
||||
(min-var dfg-min-var)
|
||||
(max-var dfg-max-var)
|
||||
(var-count dfg-var-count))
|
||||
|
||||
(define-inlinable (vector-push! vec idx val)
|
||||
|
@ -905,7 +910,13 @@ body continuation in the prompt."
|
|||
(visit-fun fun conts preds defs uses scopes scope-levels
|
||||
min-label min-var global?)
|
||||
(make-dfg conts preds defs uses scopes scope-levels
|
||||
min-label label-count min-var var-count)))))
|
||||
min-label max-label label-count
|
||||
min-var max-var var-count)))))
|
||||
|
||||
(define-syntax-rule (with-fresh-name-state-from-dfg dfg body ...)
|
||||
(parameterize ((label-counter (1+ (dfg-max-label dfg)))
|
||||
(var-counter (1+ (dfg-max-var dfg))))
|
||||
body ...))
|
||||
|
||||
(define (lookup-cont label dfg)
|
||||
(let ((res (vector-ref (dfg-cont-table dfg) (- label (dfg-min-label dfg)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue