]> gitweb.factorcode.org Git - factor.git/commitdiff
stack-checker: using cleanup.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 1 Aug 2015 03:41:46 +0000 (20:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 1 Aug 2015 03:41:46 +0000 (20:41 -0700)
12 files changed:
basis/stack-checker/alien/alien.factor
basis/stack-checker/backend/backend.factor
basis/stack-checker/branches/branches.factor
basis/stack-checker/dependencies/dependencies.factor
basis/stack-checker/errors/prettyprint/prettyprint.factor
basis/stack-checker/inlining/inlining.factor
basis/stack-checker/known-words/known-words.factor
basis/stack-checker/recursive-state/recursive-state.factor
basis/stack-checker/row-polymorphism/row-polymorphism.factor
basis/stack-checker/state/state.factor
basis/stack-checker/transforms/transforms.factor
basis/stack-checker/values/values.factor

index fdaa5add17b58705bbbd8d69d95b0400d060e1b4..b2550a13f37717bb768ef2b262da8b18000ed263 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel destructors arrays sequences accessors combinators math
-namespaces init sets words assocs alien.libraries alien
-alien.private alien.c-types fry quotations strings
-stack-checker.backend stack-checker.errors stack-checker.visitor
+USING: accessors alien alien.c-types alien.libraries
+alien.private arrays assocs combinators effects fry kernel math
+namespaces quotations sequences stack-checker.backend
 stack-checker.dependencies stack-checker.state
-compiler.utilities effects ;
+stack-checker.visitor strings words ;
 FROM: kernel.private => declare ;
 IN: stack-checker.alien
 
@@ -129,12 +128,11 @@ wait-for-callback-hook [ [ drop ] ] initialize
 M: callable wrap-callback-quot
     swap [ callback-parameter-quot ] [ callback-return-quot ] bi surround
     wait-for-callback-hook get
-    '[ _ _ do-callback ]
-    >quotation ;
+    '[ _ _ do-callback ] >quotation ;
 
 : callback-effect ( params -- effect )
-    [ parameters>> length "x" <array> ] [ return>> void? { } { "x" } ? ] bi
-    <effect> ;
+    [ parameters>> length "x" <array> ]
+    [ return>> void? { } { "x" } ? ] bi <effect> ;
 
 : infer-callback-quot ( params quot -- child )
     [
index 1191b8493ac724796a11ecdd34128a12b1d4f91b..c5c2a8aa63ae7bbcbbceef5f982c7cd1f5f95754 100644 (file)
@@ -1,11 +1,10 @@
 ! Copyright (C) 2004, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry arrays generic io io.streams.string kernel math namespaces
-parser sequences strings vectors words quotations effects classes
-continuations assocs combinators compiler.errors accessors math.order
-definitions locals sets hints macros stack-checker.state
-stack-checker.visitor stack-checker.errors stack-checker.values
-stack-checker.recursive-state stack-checker.dependencies summary ;
+USING: accessors arrays effects fry kernel locals math
+math.order namespaces quotations sequences
+stack-checker.dependencies stack-checker.errors
+stack-checker.recursive-state stack-checker.state
+stack-checker.values stack-checker.visitor words ;
 FROM: sequences.private => from-end ;
 FROM: namespaces => set ;
 IN: stack-checker.backend
index af1d8d31a4499d37f026d644927f489016eae01e..04587889ef01b596bb695b15157014cc7344bc3c 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2008, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays effects fry vectors sequences assocs math math.order accessors kernel
-combinators quotations namespaces grouping locals stack-checker.state
-stack-checker.backend stack-checker.errors stack-checker.visitor
-stack-checker.values stack-checker.recursive-state ;
+USING: accessors arrays assocs effects fry grouping kernel math
+namespaces quotations sequences stack-checker.backend
+stack-checker.errors stack-checker.recursive-state
+stack-checker.state stack-checker.values stack-checker.visitor
+vectors ;
 FROM: sequences.private => dispatch ;
 IN: stack-checker.branches
 
index ec394d2eaa027fdab53d70e12c6279f6b17c99cd..c4a13006f4a90a7a80de8c17ea821e23aa482628 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2009, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs accessors classes classes.algebra fry
-generic kernel math namespaces sequences words sets
-combinators.short-circuit classes.tuple alien.c-types ;
+USING: accessors alien.c-types arrays classes classes.algebra
+classes.tuple combinators.short-circuit fry generic kernel math
+namespaces sequences sets words ;
 FROM: classes.tuple.private => tuple-layout ;
 FROM: assocs => change-at ;
 FROM: namespaces => set ;
@@ -17,8 +17,11 @@ SYMBOLS: effect-dependency conditional-dependency definition-dependency ;
     [ index ] curry bi@ >= ;
 
 : dependency>= ( how1 how2 -- ? )
-    { effect-dependency conditional-dependency definition-dependency }
-    index>= ;
+    {
+        effect-dependency
+        conditional-dependency
+        definition-dependency
+    } index>= ;
 
 : strongest-dependency ( how1 how2 -- how )
     [ effect-dependency or ] bi@ [ dependency>= ] most ;
index 5af10102675d460a002187c7b29b804ceb2e6bbb..40eca52c6238d091857e08fb93ff431904996a0c 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays kernel prettyprint io debugger
-sequences assocs stack-checker.errors summary effects ;
+USING: accessors arrays debugger io kernel prettyprint sequences
+stack-checker.errors summary ;
 IN: stack-checker.errors.prettyprint
 
 M: unknown-macro-input summary
index 654e2b5c8e7ce2e9618e0827d368581a83dea079..a68336de55929ae9a7b2a6dd0ed2259c1fb8fb81 100644 (file)
@@ -1,18 +1,11 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry namespaces assocs kernel sequences words accessors
-definitions math math.order effects classes arrays combinators
-vectors hints
-stack-checker.state
-stack-checker.errors
-stack-checker.values
-stack-checker.visitor
-stack-checker.backend
-stack-checker.branches
-stack-checker.known-words
-stack-checker.dependencies
-stack-checker.row-polymorphism
-stack-checker.recursive-state ;
+USING: accessors arrays effects fry hints kernel math math.order
+namespaces sequences stack-checker.backend
+stack-checker.dependencies stack-checker.errors
+stack-checker.known-words stack-checker.recursive-state
+stack-checker.state stack-checker.values stack-checker.visitor
+vectors words ;
 IN: stack-checker.inlining
 
 ! Code to handle inline words. Much of the complexity stems from
@@ -107,8 +100,9 @@ SYMBOL: enter-out
     [ terminate ] when ;
 
 : check-call-height ( label -- )
-    dup entry-stack-height current-stack-height >
-    [ word>> diverging-recursion-error inference-error ] [ drop ] if ;
+    dup entry-stack-height current-stack-height > [
+        word>> diverging-recursion-error inference-error
+    ] [ drop ] if ;
 
 : trim-stack ( label seq -- stack )
     swap word>> required-stack-effect in>> length tail* ;
index c3a0cc490eb7acc527cb71e1e5726981a9ae8382..f1c4c94a0ebb1fedc6f61b34e29051bc36ef202c 100644 (file)
@@ -1,31 +1,21 @@
 ! Copyright (C) 2004, 2011 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry accessors alien alien.accessors alien.private arrays
-byte-arrays classes continuations.private effects generic
-hashtables hashtables.private io io.backend io.files
-io.files.private io.streams.c kernel kernel.private math
-math.private math.parser.private memory memory.private
-namespaces namespaces.private parser quotations
-quotations.private sbufs sbufs.private sequences
-sequences.private slots.private strings strings.private system
-threads.private classes.tuple classes.tuple.private vectors
-vectors.private words words.private definitions assocs summary
-compiler.units system.private combinators tools.memory.private
-combinators.short-circuit locals locals.backend locals.types
-combinators.private stack-checker.values generic.single
-generic.single.private alien.libraries tools.dispatch.private
-macros tools.profiler.sampling.private classes.algebra
-stack-checker.alien
-stack-checker.state
-stack-checker.errors
-stack-checker.visitor
-stack-checker.backend
-stack-checker.branches
-stack-checker.transforms
-stack-checker.dependencies
-stack-checker.recursive-state
-stack-checker.row-polymorphism ;
-QUALIFIED-WITH: generic.single.private gsp
+USING: accessors alien alien.accessors alien.libraries
+alien.private arrays assocs byte-arrays classes
+classes.tuple.private combinators combinators.private
+combinators.short-circuit compiler.units effects fry
+generic.single.private io.files.private io.streams.c kernel
+kernel.private locals locals.backend locals.types macros math
+math.parser.private math.private memory memory.private
+namespaces quotations quotations.private sequences
+sequences.private slots.private stack-checker.alien
+stack-checker.backend stack-checker.branches
+stack-checker.dependencies stack-checker.errors
+stack-checker.row-polymorphism stack-checker.state
+stack-checker.transforms stack-checker.values
+stack-checker.visitor strings strings.private system
+threads.private tools.dispatch.private tools.memory.private
+tools.profiler.sampling.private words words.private ;
 IN: stack-checker.known-words
 
 : infer-special ( word -- )
@@ -425,7 +415,7 @@ M: object infer-call* \ call bad-macro-input ;
 \ innermost-frame-scan { callstack } { fixnum } define-primitive
 \ jit-compile { quotation } { } define-primitive
 \ leaf-signal-handler { } { } define-primitive
-\ gsp:lookup-method { object array } { word } define-primitive
+\ lookup-method { object array } { word } define-primitive
 \ minor-gc { } { } define-primitive
 \ modify-code-heap { array object object } { } define-primitive
 \ nano-count { } { integer } define-primitive \ nano-count make-flushable
index 345e69e65398cab5335e059aac8544ba1ec54f26..b4f528765a9904e164607b9ccdf607526e216d07 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors kernel namespaces stack-checker.recursive-state.tree ;
+USING: accessors kernel namespaces
+stack-checker.recursive-state.tree ;
 IN: stack-checker.recursive-state
 
 TUPLE: recursive-state quotations inline-words ;
index 491b5816096c792dbf67fa211f8aa14b2b9341ab..9dcc8f9e86882f3badd41c403c44b8d5b3cb0bcc 100644 (file)
@@ -1,12 +1,9 @@
-! (c)2010 Joe Groff bsd license
-USING: accessors arrays assocs combinators combinators.short-circuit
-continuations effects fry kernel locals math math.order namespaces
-quotations sequences splitting
-stack-checker.backend
-stack-checker.errors
-stack-checker.state
-stack-checker.values
-stack-checker.visitor ;
+! Copyright (C) 2010 Joe Groff
+! See http://factorcode.org/license.txt for BSD license
+USING: accessors arrays assocs combinators
+combinators.short-circuit effects fry kernel locals math
+math.order namespaces sequences stack-checker.errors
+stack-checker.state stack-checker.values ;
 IN: stack-checker.row-polymorphism
 
 : with-inner-d ( quot -- inner-d )
index 2f898721e242d8bc4e80056c2f79842d7e61c02f..8a9d1d930071c3855c2c9b5d362709ed00e7d517 100644 (file)
@@ -29,7 +29,8 @@ SYMBOL: literals
 : commit-literals ( -- )
     literals get [ [ (push-literal) ] each ] [ delete-all ] bi ;
 
-: current-stack-height ( -- n ) meta-d length input-count get - ;
+: current-stack-height ( -- n )
+    meta-d length input-count get - ;
 
 : current-effect ( -- effect )
     input-count get "x" <array>
index fba664d629c85fc4c99232998596b32056d55b0e..012059c06ce65e53daf69b1ecec9446aa79d693f 100644 (file)
@@ -1,14 +1,11 @@
 ! Copyright (C) 2007, 2009 Slava Pestov, Daniel Ehrenberg.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: fry accessors arrays kernel kernel.private combinators.private
-words sequences generic math math.order namespaces quotations
-assocs combinators combinators.short-circuit classes.tuple
-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.dependencies ;
+USING: accessors classes.tuple classes.tuple.private combinators
+combinators.short-circuit continuations fry generic kernel
+locals namespaces quotations sequences stack-checker.backend
+stack-checker.dependencies stack-checker.errors
+stack-checker.recursive-state stack-checker.values
+stack-checker.visitor words ;
 FROM: namespaces => set ;
 IN: stack-checker.transforms
 
index ad44ae2649e6573d41f9386f897030034db739cd..7b052f9ca5200f432ab82b93f0629f83e1440e16 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors namespaces fry kernel assocs sequences
-stack-checker.recursive-state stack-checker.errors
-quotations ;
+USING: accessors assocs fry kernel namespaces quotations
+sequences stack-checker.errors stack-checker.recursive-state ;
 IN: stack-checker.values
 
 : <value> ( -- value ) \ <value> counter ;
@@ -12,10 +11,11 @@ SYMBOL: known-values
 : init-known-values ( -- )
     H{ } clone known-values set ;
 
-: known ( value -- known ) known-values get at ;
+: known ( value -- known )
+    known-values get at ;
 
 : set-known ( known value -- )
-    over [ known-values get set-at ] [ 2drop ] if ;
+    '[ _ known-values get set-at ] when* ;
 
 : make-known ( known -- value )
     <value> [ set-known ] keep ;
@@ -28,11 +28,13 @@ SYMBOL: known-values
 
 GENERIC: (literal-value?) ( value -- ? )
 
-: literal-value? ( value -- ? ) known (literal-value?) ;
+: literal-value? ( value -- ? )
+    known (literal-value?) ;
 
 GENERIC: (input-value?) ( value -- ? )
 
-: input-value? ( value -- ? ) known (input-value?) ;
+: input-value? ( value -- ? )
+    known (input-value?) ;
 
 GENERIC: (literal) ( known -- literal )
 
@@ -63,11 +65,14 @@ C: <curried> curried
 : >curried< ( curried -- obj quot )
     [ obj>> ] [ quot>> ] bi ; inline
 
-M: curried (input-value?) >curried< [ input-value? ] either? ;
+M: curried (input-value?)
+    >curried< [ input-value? ] either? ;
 
-M: curried (literal-value?) >curried< [ literal-value? ] both? ;
+M: curried (literal-value?)
+    >curried< [ literal-value? ] both? ;
 
-M: curried (literal) >curried< [ curry ] curried/composed-literal ;
+M: curried (literal)
+    >curried< [ curry ] curried/composed-literal ;
 
 TUPLE: composed quot1 quot2 ;
 
@@ -79,9 +84,11 @@ C: <composed> composed
 M: composed (input-value?)
     [ quot1>> input-value? ] [ quot2>> input-value? ] bi or ;
 
-M: composed (literal-value?) >composed< [ literal-value? ] both? ;
+M: composed (literal-value?)
+    >composed< [ literal-value? ] both? ;
 
-M: composed (literal) >composed< [ compose ] curried/composed-literal ;
+M: composed (literal)
+    >composed< [ compose ] curried/composed-literal ;
 
 SINGLETON: input-parameter
 
@@ -121,12 +128,16 @@ GENERIC: known>callable ( known -- quot )
     dup callable? [ drop [ @ ] ] unless ;
 
 M: object known>callable drop \ _ ;
+
 M: literal-tuple known>callable value>> ;
+
 M: composed known>callable
-    [ quot1>> known known>callable ?@ ] [ quot2>> known known>callable ?@ ] bi
-    append ;
+    [ quot1>> known known>callable ?@ ]
+    [ quot2>> known known>callable ?@ ] bi append ;
+
 M: curried known>callable
-    [ quot>> known known>callable ] [ obj>> known known>callable ] bi
-    prefix ;
+    [ quot>> known known>callable ]
+    [ obj>> known known>callable ] bi prefix ;
+
 M: declared-effect known>callable
     known>> known>callable ;