diff --git a/basis/compiler/cfg/dataflow-analysis/dataflow-analysis.factor b/basis/compiler/cfg/dataflow-analysis/dataflow-analysis.factor index 59f0e1a33a..2bceb4709a 100644 --- a/basis/compiler/cfg/dataflow-analysis/dataflow-analysis.factor +++ b/basis/compiler/cfg/dataflow-analysis/dataflow-analysis.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs combinators.short-circuit compiler.cfg.predecessors -compiler.cfg.rpo compiler.cfg.utilities deques dlists functors kernel lexer -locals namespaces sequences ; +USING: accessors assocs combinators.short-circuit +compiler.cfg.predecessors compiler.cfg.rpo +compiler.cfg.utilities deques dlists functors2 kernel namespaces +sequences strings ; IN: compiler.cfg.dataflow-analysis GENERIC: join-sets ( sets bb dfa -- set ) @@ -12,8 +13,6 @@ GENERIC: successors ( bb dfa -- seq ) GENERIC: predecessors ( bb dfa -- seq ) GENERIC: ignore-block? ( bb dfa -- ? ) - ( cfg dfa -- queue ) @@ -57,27 +56,14 @@ MIXIN: dataflow-analysis M: dataflow-analysis join-sets 2drop assoc-refine ; M: dataflow-analysis ignore-block? drop kill-block?>> ; - +SAME-FUNCTOR: dataflow-analysis ( name: string -- ) [[ +USING: assocs namespaces ; +SINGLETON: ${name} +SYMBOL: ${name}-ins +: ${name}-in ( bb -- set ) ${name}-ins get at ; +SYMBOL: ${name}-outs +: ${name}-out ( bb -- set ) ${name}-outs get at ; +]] ! ! ! Forward dataflow analysis @@ -88,22 +74,19 @@ M: forward-analysis block-order drop reverse-post-order ; M: forward-analysis successors drop successors>> ; M: forward-analysis predecessors drop predecessors>> ; - +]] ! ! ! Backward dataflow analysis @@ -114,27 +97,17 @@ M: backward-analysis block-order drop post-order ; M: backward-analysis successors drop predecessors>> ; M: backward-analysis predecessors drop successors>> ; - - -PRIVATE> - -SYNTAX: \FORWARD-ANALYSIS: - scan-token [ define-analysis ] [ define-forward-analysis ] bi ; - -SYNTAX: \BACKWARD-ANALYSIS: - scan-token [ define-analysis ] [ define-backward-analysis ] bi ; diff --git a/core/functors2/functors2.factor b/core/functors2/functors2.factor index fa36ae3855..865b72e7d7 100644 --- a/core/functors2/functors2.factor +++ b/core/functors2/functors2.factor @@ -125,13 +125,13 @@ ERROR: no-type arg ; : argument>type ( argument -- type ) dup array? [ ?second ] [ no-type ] if ; -SINGLETONS: new-class new-word existing-class existing-word string ; +SINGLETONS: new-class new-word existing-class existing-word ; CONSTANT: scanner-table H{ { new-class [ scan-new-class ] } { existing-class [ scan-class ] } { new-word [ scan-new-word ] } { existing-word [ scan-word ] } - ! { string [ scan-token ] } + { string [ scan-token ] } } : type>scanner ( obj -- quot )