diff --git a/basis/compiler/compiler.factor b/basis/compiler/compiler.factor index 161b6a4896..e3c2ed4697 100755 --- a/basis/compiler/compiler.factor +++ b/basis/compiler/compiler.factor @@ -5,7 +5,8 @@ continuations vocabs assocs dlists definitions math graphs generic generic.single combinators deques search-deques macros source-files.errors combinators.short-circuit -stack-checker stack-checker.state stack-checker.inlining stack-checker.errors +stack-checker stack-checker.dependencies stack-checker.inlining +stack-checker.errors compiler.errors compiler.units compiler.utilities diff --git a/basis/compiler/crossref/crossref.factor b/basis/compiler/crossref/crossref.factor index f3b65ce151..e6ef5cf17c 100644 --- a/basis/compiler/crossref/crossref.factor +++ b/basis/compiler/crossref/crossref.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: assocs classes.algebra compiler.units definitions graphs -grouping kernel namespaces sequences words stack-checker.state ; +grouping kernel namespaces sequences words +stack-checker.dependencies ; IN: compiler.crossref SYMBOL: compiled-crossref diff --git a/basis/compiler/tree/cleanup/cleanup.factor b/basis/compiler/tree/cleanup/cleanup.factor index 8ed83188e5..ec819d0eac 100644 --- a/basis/compiler/tree/cleanup/cleanup.factor +++ b/basis/compiler/tree/cleanup/cleanup.factor @@ -3,7 +3,7 @@ USING: kernel accessors sequences combinators fry classes.algebra namespaces assocs words math math.private math.partial-dispatch math.intervals classes classes.tuple -classes.tuple.private layouts definitions stack-checker.state +classes.tuple.private layouts definitions stack-checker.dependencies stack-checker.branches compiler.utilities compiler.tree diff --git a/basis/compiler/tree/dead-code/simple/simple.factor b/basis/compiler/tree/dead-code/simple/simple.factor index f6165a44ab..67c5cfdc78 100755 --- a/basis/compiler/tree/dead-code/simple/simple.factor +++ b/basis/compiler/tree/dead-code/simple/simple.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel accessors words assocs sequences arrays namespaces fry locals definitions classes classes.algebra generic -stack-checker.state +stack-checker.dependencies stack-checker.backend compiler.tree compiler.tree.propagation.info diff --git a/basis/compiler/tree/propagation/known-words/known-words.factor b/basis/compiler/tree/propagation/known-words/known-words.factor index 8afbaf0099..1453bebf9a 100644 --- a/basis/compiler/tree/propagation/known-words/known-words.factor +++ b/basis/compiler/tree/propagation/known-words/known-words.factor @@ -8,7 +8,7 @@ classes.algebra combinators generic.math splitting fry locals classes.tuple alien.accessors classes.tuple.private slots.private definitions strings.private vectors hashtables generic quotations alien -stack-checker.state +stack-checker.dependencies compiler.tree.comparisons compiler.tree.propagation.info compiler.tree.propagation.nodes diff --git a/basis/compiler/tree/propagation/simple/simple.factor b/basis/compiler/tree/propagation/simple/simple.factor index 5de5e26a30..b4d8b95247 100644 --- a/basis/compiler/tree/propagation/simple/simple.factor +++ b/basis/compiler/tree/propagation/simple/simple.factor @@ -4,7 +4,7 @@ USING: fry accessors kernel sequences sequences.private assocs words namespaces classes.algebra combinators combinators.short-circuit classes classes.tuple classes.tuple.private continuations arrays alien.c-types math -math.private slots generic definitions stack-checker.state +math.private slots generic definitions stack-checker.dependencies compiler.tree compiler.tree.propagation.info compiler.tree.propagation.nodes diff --git a/basis/compiler/tree/propagation/transforms/transforms.factor b/basis/compiler/tree/propagation/transforms/transforms.factor index ff68fb2400..294b883403 100644 --- a/basis/compiler/tree/propagation/transforms/transforms.factor +++ b/basis/compiler/tree/propagation/transforms/transforms.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel sequences words fry generic accessors classes.tuple classes classes.algebra definitions -stack-checker.state quotations classes.tuple.private math +stack-checker.dependencies quotations classes.tuple.private math math.partial-dispatch math.private math.intervals sets.private math.floats.private math.integers.private layouts math.order vectors hashtables combinators effects generalizations assocs diff --git a/basis/stack-checker/backend/backend.factor b/basis/stack-checker/backend/backend.factor index 5411c885ad..2d4c1e9c61 100755 --- a/basis/stack-checker/backend/backend.factor +++ b/basis/stack-checker/backend/backend.factor @@ -5,7 +5,7 @@ parser sequences strings vectors words quotations effects classes continuations assocs combinators compiler.errors accessors math.order definitions sets hints macros stack-checker.state stack-checker.visitor stack-checker.errors stack-checker.values -stack-checker.recursive-state summary ; +stack-checker.recursive-state stack-checker.dependencies summary ; IN: stack-checker.backend : push-d ( obj -- ) meta-d push ; diff --git a/basis/stack-checker/dependencies/authors.txt b/basis/stack-checker/dependencies/authors.txt new file mode 100644 index 0000000000..d4f5d6b3ae --- /dev/null +++ b/basis/stack-checker/dependencies/authors.txt @@ -0,0 +1 @@ +Slava Pestov \ No newline at end of file diff --git a/basis/stack-checker/dependencies/dependencies.factor b/basis/stack-checker/dependencies/dependencies.factor new file mode 100644 index 0000000000..f0c77b8398 --- /dev/null +++ b/basis/stack-checker/dependencies/dependencies.factor @@ -0,0 +1,37 @@ +! Copyright (C) 2009 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: assocs classes.algebra fry kernel math namespaces +sequences words ; +IN: stack-checker.dependencies + +! Words that the current quotation depends on +SYMBOL: dependencies + +SYMBOLS: inlined-dependency flushed-dependency called-dependency ; + +: index>= ( obj1 obj2 seq -- ? ) + [ index ] curry bi@ >= ; + +: dependency>= ( how1 how2 -- ? ) + { called-dependency flushed-dependency inlined-dependency } + index>= ; + +: strongest-dependency ( how1 how2 -- how ) + [ called-dependency or ] bi@ [ dependency>= ] most ; + +: depends-on ( word how -- ) + over primitive? [ 2drop ] [ + dependencies get dup [ + swap '[ _ strongest-dependency ] change-at + ] [ 3drop ] if + ] if ; + +! Generic words that the current quotation depends on +SYMBOL: generic-dependencies + +: ?class-or ( class/f class -- class' ) + swap [ class-or ] when* ; + +: depends-on-generic ( generic class -- ) + generic-dependencies get dup + [ swap '[ _ ?class-or ] change-at ] [ 3drop ] if ; diff --git a/basis/stack-checker/inlining/inlining.factor b/basis/stack-checker/inlining/inlining.factor index c99e0f0252..d94868688c 100644 --- a/basis/stack-checker/inlining/inlining.factor +++ b/basis/stack-checker/inlining/inlining.factor @@ -10,6 +10,7 @@ stack-checker.visitor stack-checker.backend stack-checker.branches stack-checker.known-words +stack-checker.dependencies stack-checker.recursive-state ; IN: stack-checker.inlining diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index 154e67ebb1..9095eaca8a 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -21,6 +21,7 @@ stack-checker.visitor stack-checker.backend stack-checker.branches stack-checker.transforms +stack-checker.dependencies stack-checker.recursive-state ; IN: stack-checker.known-words diff --git a/basis/stack-checker/state/state.factor b/basis/stack-checker/state/state.factor index bd9c57efbc..c0d3d05409 100644 --- a/basis/stack-checker/state/state.factor +++ b/basis/stack-checker/state/state.factor @@ -44,35 +44,3 @@ SYMBOL: literals V{ } clone \ meta-d set V{ } clone literals set 0 d-in set ; - -! Words that the current quotation depends on -SYMBOL: dependencies - -SYMBOLS: inlined-dependency flushed-dependency called-dependency ; - -: index>= ( obj1 obj2 seq -- ? ) - [ index ] curry bi@ >= ; - -: dependency>= ( how1 how2 -- ? ) - { called-dependency flushed-dependency inlined-dependency } - index>= ; - -: strongest-dependency ( how1 how2 -- how ) - [ called-dependency or ] bi@ [ dependency>= ] most ; - -: depends-on ( word how -- ) - over primitive? [ 2drop ] [ - dependencies get dup [ - swap '[ _ strongest-dependency ] change-at - ] [ 3drop ] if - ] if ; - -! Generic words that the current quotation depends on -SYMBOL: generic-dependencies - -: ?class-or ( class/f class -- class' ) - swap [ class-or ] when* ; - -: depends-on-generic ( generic class -- ) - generic-dependencies get dup - [ swap '[ _ ?class-or ] change-at ] [ 3drop ] if ; diff --git a/basis/stack-checker/transforms/transforms.factor b/basis/stack-checker/transforms/transforms.factor index 11534c58f9..53f8b77ad8 100755 --- a/basis/stack-checker/transforms/transforms.factor +++ b/basis/stack-checker/transforms/transforms.factor @@ -7,7 +7,8 @@ classes.tuple.private effects summary hashtables classes sets definitions generic.standard slots.private continuations locals sequences.private generalizations stack-checker.backend stack-checker.state stack-checker.visitor stack-checker.errors -stack-checker.values stack-checker.recursive-state ; +stack-checker.values stack-checker.recursive-state +stack-checker.dependencies ; IN: stack-checker.transforms : call-transformer ( word stack quot -- newquot ) diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 558018a147..4991a0860a 100644 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -3,7 +3,7 @@ USING: arrays definitions generic assocs kernel math namespaces sequences strings vectors words quotations io io.files io.pathnames combinators sorting splitting math.parser effects -continuations checksums checksums.crc32 vocabs hashtables graphs +continuations checksums checksums.crc32 vocabs hashtables compiler.units io.encodings.utf8 accessors source-files.errors ; IN: source-files diff --git a/core/words/words.factor b/core/words/words.factor index d2fe7d2625..24a95853da 100755 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2004, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays definitions graphs kernel -kernel.private slots.private math namespaces sequences -strings vectors sbufs quotations assocs hashtables sorting vocabs -math.order sets words.private ; +USING: accessors arrays definitions kernel kernel.private +slots.private math namespaces sequences strings vectors sbufs +quotations assocs hashtables sorting vocabs math.order sets +words.private ; IN: words : word ( -- word ) \ word get-global ;