]> gitweb.factorcode.org Git - factor.git/commitdiff
Remove some unnecessary work from stack-analysis pass
authorSlava Pestov <slava@shill.local>
Fri, 17 Jul 2009 23:39:41 +0000 (18:39 -0500)
committerSlava Pestov <slava@shill.local>
Fri, 17 Jul 2009 23:39:41 +0000 (18:39 -0500)
basis/compiler/cfg/stack-analysis/stack-analysis.factor

index e46460a7413254d113fe4f570ccb49e2dbbc8c69..cf15c0a312042fd037c4eddfa88ed34244e1bf2b 100644 (file)
@@ -92,14 +92,11 @@ M: poison-insn visit call-next-method poison-state ;
 M: kill-vreg-insn visit sync-state , ;
 
 ! Maps basic-blocks to states
-SYMBOLS: state-in state-out ;
+SYMBOL: state-out
 
 : block-in-state ( bb -- states )
     dup predecessors>> state-out get '[ _ at ] map merge-states ;
 
-: set-block-in-state ( state bb -- )
-    [ clone ] dip state-in get set-at ;
-
 : set-block-out-state ( state bb -- )
     [ clone ] dip state-out get set-at ;
 
@@ -109,21 +106,18 @@ SYMBOLS: state-in state-out ;
     [
         dup basic-block set
         dup block-in-state
-        [ swap set-block-in-state ] [
-            state [
-                [ instructions>> [ visit ] each ]
-                [ [ state get ] dip set-block-out-state ]
-                [ ]
-                tri
-            ] with-variable
-        ] 2bi
+        state [
+            [ instructions>> [ visit ] each ]
+            [ [ state get ] dip set-block-out-state ]
+            [ ]
+            tri
+        ] with-variable
     ] V{ } make >>instructions drop ;
 
 : stack-analysis ( cfg -- cfg' )
     [
         <hashed-dlist> work-list set
         H{ } clone copies set
-        H{ } clone state-in set
         H{ } clone state-out set
         dup [ visit-block ] each-basic-block
         global-optimization? get [ work-list get [ visit-block ] slurp-deque ] when