compiler.crossref: memoize dependency evaluation

release
Slava Pestov 2010-01-30 05:09:49 +13:00
parent c438e84bd0
commit 015a9d365d
1 changed files with 5 additions and 4 deletions

View File

@ -23,15 +23,16 @@ compiled-generic-crossref [ H{ } clone ] initialize
[ drop word? ] assoc-filter [ drop word? ] assoc-filter
[ [ drop (compiled-usages) ] { } assoc>map ] keep suffix ; [ [ drop (compiled-usages) ] { } assoc>map ] keep suffix ;
: dependencies-satisfied? ( word -- ? ) : dependencies-satisfied? ( word cache -- ? )
"dependency-checks" word-prop [ satisfied? ] all? ; [ "dependency-checks" word-prop ] dip
'[ _ [ satisfied? ] cache ] all? ;
: outdated-conditional-usages ( assoc -- assocs ) : outdated-conditional-usages ( assoc -- assocs )
[ H{ } clone '[
drop drop
compiled-usage compiled-usage
[ nip conditional-dependency dependency>= ] assoc-filter [ nip conditional-dependency dependency>= ] assoc-filter
[ drop dependencies-satisfied? not ] assoc-filter [ drop _ dependencies-satisfied? not ] assoc-filter
] { } assoc>map ; ] { } assoc>map ;
: compiled-generic-usage ( word -- assoc ) : compiled-generic-usage ( word -- assoc )