From 99d8520dda5abf1d0699a88ce967e2c83826b5ad Mon Sep 17 00:00:00 2001 From: Chris Double Date: Sun, 4 Sep 2005 01:14:46 +0000 Subject: [PATCH 01/18] Add gadgets-layouts USE for 0.77 changes --- contrib/concurrency/concurrency-examples.factor | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/concurrency/concurrency-examples.factor b/contrib/concurrency/concurrency-examples.factor index 279141ddc0..705a8492a7 100644 --- a/contrib/concurrency/concurrency-examples.factor +++ b/contrib/concurrency/concurrency-examples.factor @@ -158,6 +158,7 @@ M: crash-command run-rpc-command ( command -- shutdown? result ) USE: gadgets USE: gadgets-labels USE: gadgets-presentations +USE: gadgets-layouts USE: generic TUPLE: promised-label promise ; From 16196db489c8c4c25fbc175bd93e474eaf5f7eef Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 4 Sep 2005 02:28:46 +0000 Subject: [PATCH 02/18] fix compiler bug uncovered by doublec --- CHANGES.html | 4 +++- TODO.FACTOR.txt | 1 + library/compiler/ppc/generator.factor | 2 +- library/inference/call-optimizers.factor | 14 ++++++++++++-- library/test/compiler/optimizer.factor | 6 ++++++ library/ui/ui.factor | 6 +++--- version.factor | 2 +- 7 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGES.html b/CHANGES.html index 5ab313438f..3437c32695 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -22,6 +22,8 @@
  • Collections:
      +
    • sort ( seq quot -- | quot: elt elt -- -1/0/1 ) combinator now works with any sequence, not just a list. The comparator also has to return a signed integer, not just a boolean. It is much faster than the old sorting algorithm.
    • +
    • binsearch ( elt seq quot -- i | quot: elt elt -- -1/0/1 ) and binsearch ( elt seq quot -- elt | quot: elt elt -- -1/0/1 ) combinators perform a binary search on a sorted sequence.
    • 2each ( seq seq quot -- quot: elt -- elt ) combinator
    • join ( seq glue -- seq ) word. Takes a sequence of sequences, and constructs a new sequence with the glue in between each sequence. For example:
        [ "usr" "bin" "grep" ] "/" join
      @@ -79,7 +81,7 @@ make-sbuf    ==> SBUF" " make
       
    • New sleep ( ms -- ) word pauses current thread for a number of milliseconds.
    • New with-datastack ( stack word -- stack ) combinator.
    • New cond ( conditions -- ) combinator. It behaves like a set of nested iftes, and compiles if each branch has the same stack effect. See its documentation comment for details.
    • -
    • Formally documented method combination (G: syntax) in handbook. +
    • Formally documented method combination (G: syntax) in handbook.
    • Erlang/Termite-style concurrency library in contrib/concurrency (Chris Double).
    • Completely redid infix algebra in contrib/algebra/. Now, vector operations are possible and the syntax doesn't use so many spaces. New way to write the quadratic formula: diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 8b7b2844fe..a4bf89eed7 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -66,6 +66,7 @@ + kernel: +- friendlier .factor-rc load error handling - reader syntax for arrays, byte arrays, displaced aliens - out of memory error when printing global namespace - first time hash/vector is grown, set size to something big diff --git a/library/compiler/ppc/generator.factor b/library/compiler/ppc/generator.factor index 04ad255895..08c3b149e5 100644 --- a/library/compiler/ppc/generator.factor +++ b/library/compiler/ppc/generator.factor @@ -125,4 +125,4 @@ M: %type generate-node ( vop -- ) 17 18 MR ; M: %tag generate-node ( vop -- ) - dup vop-in-1 swap vop-out-1 tag-mask ANDI ; + dup vop-in-1 v>operand swap vop-out-1 v>operand tag-mask ANDI ; diff --git a/library/inference/call-optimizers.factor b/library/inference/call-optimizers.factor index 66db22caad..41229b3527 100644 --- a/library/inference/call-optimizers.factor +++ b/library/inference/call-optimizers.factor @@ -37,11 +37,21 @@ sequences vectors words ; [ 3drop t ] [ inline-literals ] ifte ] catch ; -: flip-branches ( #ifte -- ) +: flip-subst ( not -- ) + #! Note: cloning the vectors, since subst-values will modify + #! them. + [ node-in-d clone ] keep + [ node-out-d clone ] keep + subst-values ; + +: flip-branches ( not -- #ifte ) + #! If a not is followed by an #ifte, flip branches and + #! remove the note. + dup flip-subst node-successor dup dup node-children first2 swap 2vector swap set-node-children ; \ not { - { [ dup node-successor #ifte? ] [ node-successor dup flip-branches ] } + { [ dup node-successor #ifte? ] [ flip-branches ] } } define-optimizers : disjoint-eq? ( node -- ? ) diff --git a/library/test/compiler/optimizer.factor b/library/test/compiler/optimizer.factor index e56ce41343..3b92a6fd24 100644 --- a/library/test/compiler/optimizer.factor +++ b/library/test/compiler/optimizer.factor @@ -171,3 +171,9 @@ TUPLE: pred-test ; : fixnum-declarations >fixnum 24 shift 1234 bitxor ; compiled [ ] [ 1000000 fixnum-declarations . ] unit-test + +! regression + +: literal-not-branch 0 not [ ] [ ] ifte ; compiled + +[ ] [ literal-not-branch ] unit-test diff --git a/library/ui/ui.factor b/library/ui/ui.factor index 07371e0fb8..e9edf02abc 100644 --- a/library/ui/ui.factor +++ b/library/ui/ui.factor @@ -22,7 +22,7 @@ styles threads words ; ttf-init global [ world set - { 600 800 0 } world get set-gadget-dim + { 600 700 0 } world get set-gadget-dim world-theme world get set-gadget-paint @@ -38,11 +38,11 @@ global [ first-time on ] bind : ?init-world first-time get [ init-world first-time off ] when ; -IN: shells - : ui-title [ "Factor " % version % " - " % "image" get % ] "" make ; +IN: shells + : ui ( -- ) #! Start the Factor graphics subsystem with the given screen #! dimensions. diff --git a/version.factor b/version.factor index d66bf72f8a..ecfd53c25f 100644 --- a/version.factor +++ b/version.factor @@ -1,2 +1,2 @@ IN: kernel -: version "0.77" ; +: version "0.78" ; From 394b5da71be4dc82e484a298d749730b073933d0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 4 Sep 2005 02:50:44 +0000 Subject: [PATCH 03/18] add missing file --- doc/makeglos | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 doc/makeglos diff --git a/doc/makeglos b/doc/makeglos new file mode 100755 index 0000000000..00723d0631 --- /dev/null +++ b/doc/makeglos @@ -0,0 +1,2 @@ +#!/bin/sh +makeindex -s $1.ist -t $1.glg -o $1.gls $1.glo From eb73ee864f1f72ce7596ed3393fb93d30b26a953 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 4 Sep 2005 05:09:46 +0000 Subject: [PATCH 04/18] #label optimizer fix --- TODO.FACTOR.txt | 1 - doc/handbook.tex | 7 ++++--- library/compiler/linearizer.factor | 2 +- library/inference/dataflow.factor | 14 ++++++++++++++ library/inference/inference.factor | 2 +- library/inference/optimizer.factor | 12 ------------ library/inference/print-dataflow.factor | 2 +- library/inference/recursive-values.factor | 2 +- library/inference/split-nodes.factor | 5 +++-- library/inference/words.factor | 18 +++++++++++++++++- library/kernel.factor | 23 ++++++++++++----------- 11 files changed, 54 insertions(+), 34 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index a4bf89eed7..87cd31c9ab 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -48,7 +48,6 @@ + compiler: -- removing unneeded #label - flushing optimization - compile-byte/cell: instantiating aliens - fix fixnum<< and /i overflow on PowerPC diff --git a/doc/handbook.tex b/doc/handbook.tex index 6601294243..d78af4a014 100644 --- a/doc/handbook.tex +++ b/doc/handbook.tex @@ -2627,10 +2627,11 @@ Outputs \texttt{t} if the quotation yields true when applied to each element, ot \ordinaryword{monotonic?}{monotonic?~( seq quot -- ?~)} \texttt{quot:~element element -- ?}\\ } -Tests if all elements of the sequence are equivalent under the relation. The quotation should be an equality relation (see \ref{equality}), otherwise the result will not be useful. This is implemented by vacuously outputting \verb|t| if the sequence is empty, or otherwise, by applying the quotation to each element together with the first element in turn, and testing if it always yields a true value. Usually, this word is used to test if all elements of a sequence are equal, or the same element: +Applies the relation to successive pairs of elements in the sequence, testing for a truth value. The relation should be a transitive relation, such as a total order or an equality relation. Examples: \begin{verbatim} -[ = ] every? -[ eq? ] every? +[ = ] monotonic? ! is every element equal? +[ eq? ] monotonic? ! is every element identical? +[ < ] monotonic? ! is the sequence increasing? \end{verbatim} A pair of utility words test of every element in a sequence is true, or if the sequence contains at least one true element. diff --git a/library/compiler/linearizer.factor b/library/compiler/linearizer.factor index 23ca7b2304..69403c4b00 100644 --- a/library/compiler/linearizer.factor +++ b/library/compiler/linearizer.factor @@ -25,7 +25,7 @@ M: node linearize-node* ( node -- ) drop ; M: #label linearize-node* ( node -- )