]> gitweb.factorcode.org Git - factor.git/commitdiff
Re-work flushed dependencies into new compiler cross-referencing framework
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 29 Jan 2010 13:58:39 +0000 (02:58 +1300)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 29 Jan 2010 20:29:00 +0000 (09:29 +1300)
12 files changed:
basis/compiler/compiler.factor
basis/compiler/crossref/crossref.factor
basis/compiler/tree/dead-code/simple/simple.factor
basis/macros/macros.factor
basis/stack-checker/dependencies/dependencies-tests.factor
basis/stack-checker/dependencies/dependencies.factor
core/classes/mixin/mixin.factor
core/classes/tuple/tuple.factor
core/classes/union/union.factor
core/compiler/units/units.factor
core/definitions/definitions.factor
core/words/words.factor

index 2bdff71781003d64d89b1453f944259c464e7bc5..cce33c2f8de31f32213f3cadd2abdee69c5d5354 100644 (file)
@@ -203,7 +203,7 @@ M: optimizing-compiler recompile ( words -- alist )
 
 M: optimizing-compiler to-recompile ( -- words )
     changed-definitions get compiled-usages
-    changed-classes get outdated-class-usages
+    maybe-changed get outdated-conditional-usages
     append assoc-combine keys ;
 
 M: optimizing-compiler process-forgotten-words
index 72e2c07c34262b8192e1e937cf2216bd300e7ea3..d0595f53b6848ee355c06d4cbf7a3d5e915c2838 100644 (file)
@@ -17,13 +17,7 @@ compiled-generic-crossref [ H{ } clone ] initialize
     compiled-crossref get at ;
 
 : (compiled-usages) ( word -- assoc )
-    #! If the word is not flushable anymore, we have to recompile
-    #! all words which flushable away a call (presumably when the
-    #! word was still flushable). If the word is flushable, we
-    #! don't have to recompile words that folded this away.
-    [ compiled-usage ]
-    [ "flushable" word-prop inlined-dependency flushed-dependency ? ] bi
-    '[ nip _ dependency>= ] assoc-filter ;
+    compiled-usage [ nip inlined-dependency dependency>= ] assoc-filter ;
 
 : compiled-usages ( assoc -- assocs )
     [ drop word? ] assoc-filter
@@ -32,7 +26,7 @@ compiled-generic-crossref [ H{ } clone ] initialize
 : dependencies-satisfied? ( word -- ? )
     "conditional-dependencies" word-prop [ satisfied? ] all? ;
 
-: outdated-class-usages ( assoc -- assocs )
+: outdated-conditional-usages ( assoc -- assocs )
     [
         drop
         compiled-usage
index 08569206791d1629cc12c0e6f10c4dc12d12da13..5582f4dc6fe07519b7b58fdbf91352cfc7399c00 100644 (file)
@@ -90,7 +90,7 @@ M: #push remove-dead-code*
     ] [ drop f ] if ;
 
 : remove-flushable-call ( #call -- node )
-    [ word>> flushed-dependency depends-on ]
+    [ word>> depends-on-flushable ]
     [ in-d>> #drop remove-dead-code* ]
     bi ;
 
index 29c4fb60936b9e1ccf14a993c0fa92cd90b734cd..46fd1ce7481726fdd639a22e7d254a5f9883c497 100644 (file)
@@ -32,4 +32,4 @@ M: macro definition "macro" word-prop ;
 M: macro reset-word
     [ call-next-method ] [ f "macro" set-word-prop ] bi ;
 
-M: macro bump-effect-counter* drop t ;
+M: macro always-bump-effect-counter? drop t ;
index 9bcec64033c01d22a2bfb878065f87ce446a0947..2b6686e247205c8f66f17fd6f97609ea6c91ce61 100644 (file)
@@ -28,10 +28,3 @@ SYMBOL: b
         b inlined-dependency depends-on
     ] computing-dependencies
 ] unit-test
-
-[ flushed-dependency ] [ f flushed-dependency strongest-dependency ] unit-test
-[ flushed-dependency ] [ flushed-dependency f strongest-dependency ] unit-test
-[ inlined-dependency ] [ flushed-dependency inlined-dependency strongest-dependency ] unit-test
-[ inlined-dependency ] [ called-dependency inlined-dependency strongest-dependency ] unit-test
-[ flushed-dependency ] [ called-dependency flushed-dependency strongest-dependency ] unit-test
-[ called-dependency ] [ called-dependency f strongest-dependency ] unit-test
index 004c1dd07d556fe09fd918c4f2eac01c60dfaa80..865fedebca5b5748c8816c413ccdb63fa66b4b5c 100644 (file)
@@ -79,6 +79,15 @@ TUPLE: depends-on-method class generic method ;
 M: depends-on-method satisfied?
     [ [ class>> ] [ generic>> ] bi method-for-class ] [ method>> ] bi eq? ;
 
+TUPLE: depends-on-flushable word ;
+
+: depends-on-flushable ( word -- )
+    [ depends-on-conditionally ]
+    [ \ depends-on-flushable add-conditional-dependency ] bi ;
+
+M: depends-on-flushable satisfied?
+    word>> flushable? ;
+
 : init-dependencies ( -- )
     H{ } clone dependencies set
     H{ } clone generic-dependencies set
index 16e4ff124ecbc1964908ca38c5af304283f46dce..8a48a25160bdbebb7f6ea63b21fa62ed8ca4f55d 100644 (file)
@@ -28,7 +28,7 @@ TUPLE: check-mixin-class class ;
 
 : redefine-mixin-class ( class members -- )
     [ (define-union-class) ]
-    [ drop changed-class ]
+    [ drop changed-conditionally ]
     [ drop t "mixin" set-word-prop ]
     2tri ;
 
index 12d90e036bae795ade6dae0e14946ceb768cbe6e..620c65c8655473552b784d6ee18db8184211f314 100644 (file)
@@ -223,7 +223,7 @@ M: tuple-class update-class
         2drop
         [
             [ update-tuples-after ]
-            [ changed-class ]
+            [ changed-conditionally ]
             bi
         ] each-subclass
     ]
index 44a1c227744395ad72af68812625fe9e6e21f00f..518ba37d7ccf970e06da3dcc642cea1ebdcc965d 100644 (file)
@@ -32,7 +32,7 @@ PRIVATE>
 
 : define-union-class ( class members -- )
     [ (define-union-class) ]
-    [ drop changed-class ]
+    [ drop changed-conditionally ]
     [ drop update-classes ]
     2tri ;
 
index 21ab578ccc19cc09b84916cbe08a30d851b850b8..386d5750bfe1cf985720ca8249b57095981ef8f0 100644 (file)
@@ -123,7 +123,7 @@ M: object always-bump-effect-counter? drop f ;
     dup new-definitions get first update
     dup new-definitions get second update
     dup changed-definitions get update
-    dup changed-classes get update
+    dup maybe-changed get update
     dup dup changed-vocabs update ;
 
 : process-forgotten-definitions ( -- )
@@ -134,7 +134,7 @@ M: object always-bump-effect-counter? drop f ;
 
 : bump-effect-counter? ( -- ? )
     changed-effects get
-    changed-classes get
+    maybe-changed get
     changed-definitions get [ drop always-bump-effect-counter? ] assoc-filter
     3array assoc-combine new-words get assoc-diff assoc-empty? not ;
 
@@ -165,7 +165,7 @@ PRIVATE>
 : with-nested-compilation-unit ( quot -- )
     [
         H{ } clone changed-definitions set
-        H{ } clone changed-classes set
+        H{ } clone maybe-changed set
         H{ } clone changed-effects set
         H{ } clone outdated-generics set
         H{ } clone outdated-tuples set
@@ -176,7 +176,7 @@ PRIVATE>
 : with-compilation-unit ( quot -- )
     [
         H{ } clone changed-definitions set
-        H{ } clone changed-classes set
+        H{ } clone maybe-changed set
         H{ } clone changed-effects set
         H{ } clone outdated-generics set
         H{ } clone forgotten-definitions set
index 7110e27e049373d18904560e0290c3cbe0ab095f..e255b161ee8c6834b7054bd5013e09cf05f74219 100644 (file)
@@ -15,10 +15,10 @@ SYMBOL: changed-definitions
 : changed-definition ( defspec -- )
     dup changed-definitions get set-in-unit ;
 
-SYMBOL: changed-classes
+SYMBOL: maybe-changed
 
-: changed-class ( class -- )
-    dup changed-classes get set-in-unit ;
+: changed-conditionally ( class -- )
+    dup maybe-changed get set-in-unit ;
 
 SYMBOL: changed-effects
 
index 106cca29fa17ee56715e3e887a7f9bc665fb4392..4fe00d1edf4dcf9796d2d185743f825e9465eb25 100644 (file)
@@ -110,9 +110,14 @@ M: word make-inline
 : define-inline ( word def effect -- )
     [ define-declared ] [ 2drop make-inline ] 3bi ;
 
+GENERIC: flushable? ( word -- ? )
+
+M: word flushable? "flushable" word-prop ;
+
 GENERIC: reset-word ( word -- )
 
 M: word reset-word
+    dup flushable? [ dup changed-conditionally ] when
     {
         "unannotated-def" "parsing" "inline" "recursive"
         "foldable" "flushable" "reading" "writing" "reader"
@@ -182,10 +187,6 @@ M: parsing-word definer drop \ SYNTAX: \ ; ;
 : deprecated? ( obj -- ? )
     dup word? [ "deprecated" word-prop ] [ drop f ] if ;
 
-GENERIC: flushable? ( word -- ? )
-
-M: word flushable? "flushable" word-prop ;
-
 ! Definition protocol
 M: word where "loc" word-prop ;