From aa8769c29dd6e98fd87f1f5aa3a94d73d0cbfccc Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Wed, 13 Feb 2008 20:19:18 -0600 Subject: [PATCH 01/67] Making lists into a mixin --- extra/lazy-lists/lazy-lists.factor | 67 ++++++++---------------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/extra/lazy-lists/lazy-lists.factor b/extra/lazy-lists/lazy-lists.factor index 1979819dd1..e3e7b14917 100644 --- a/extra/lazy-lists/lazy-lists.factor +++ b/extra/lazy-lists/lazy-lists.factor @@ -9,13 +9,10 @@ quotations promises combinators io ; IN: lazy-lists ! Lazy List Protocol +MIXIN: list GENERIC: car ( cons -- car ) GENERIC: cdr ( cons -- cdr ) GENERIC: nil? ( cons -- ? ) -GENERIC: list? ( object -- ? ) - -M: object list? ( object -- bool ) - drop f ; M: promise car ( promise -- car ) force car ; @@ -26,9 +23,6 @@ M: promise cdr ( promise -- cdr ) M: promise nil? ( cons -- bool ) force nil? ; -M: promise list? ( object -- bool ) - drop t ; - TUPLE: cons car cdr ; C: cons cons @@ -45,9 +39,6 @@ M: cons cdr ( cons -- cdr ) M: cons nil? ( cons -- bool ) nil eq? ; -M: cons list? ( object -- bool ) - drop t ; - : 1list ( obj -- cons ) nil cons ; @@ -74,9 +65,6 @@ M: lazy-cons cdr ( lazy-cons -- cdr ) M: lazy-cons nil? ( lazy-cons -- bool ) nil eq? ; -M: lazy-cons list? ( object -- bool ) - drop t ; - : 1lazy-list ( a -- lazy-cons ) [ nil ] lazy-cons ; @@ -138,9 +126,6 @@ M: memoized-cons nil? ( memoized-cons -- bool ) memoized-cons-nil? ] if ; -M: memoized-cons list? ( object -- bool ) - drop t ; - TUPLE: lazy-map cons quot ; C: lazy-map @@ -159,9 +144,6 @@ M: lazy-map cdr ( lazy-map -- cdr ) M: lazy-map nil? ( lazy-map -- bool ) lazy-map-cons nil? ; -M: lazy-map list? ( object -- bool ) - drop t ; - TUPLE: lazy-map-with value cons quot ; C: lazy-map-with @@ -182,9 +164,6 @@ M: lazy-map-with cdr ( lazy-map-with -- cdr ) M: lazy-map-with nil? ( lazy-map-with -- bool ) lazy-map-with-cons nil? ; -M: lazy-map-with list? ( object -- bool ) - drop t ; - TUPLE: lazy-take n cons ; C: lazy-take @@ -206,9 +185,6 @@ M: lazy-take nil? ( lazy-take -- bool ) lazy-take-cons nil? ] if ; -M: lazy-take list? ( object -- bool ) - drop t ; - TUPLE: lazy-until cons quot ; C: lazy-until @@ -226,9 +202,6 @@ M: lazy-until cdr ( lazy-until -- cdr ) M: lazy-until nil? ( lazy-until -- bool ) drop f ; -M: lazy-until list? ( lazy-until -- bool ) - drop t ; - TUPLE: lazy-while cons quot ; C: lazy-while @@ -245,9 +218,6 @@ M: lazy-while cdr ( lazy-while -- cdr ) M: lazy-while nil? ( lazy-while -- bool ) [ car ] keep lazy-while-quot call not ; -M: lazy-while list? ( lazy-while -- bool ) - drop t ; - TUPLE: lazy-subset cons quot ; C: lazy-subset @@ -285,9 +255,6 @@ M: lazy-subset nil? ( lazy-subset -- bool ) ] if ] if ; -M: lazy-subset list? ( object -- bool ) - drop t ; - : list>vector ( list -- vector ) [ [ , ] leach ] V{ } make ; @@ -311,9 +278,6 @@ M: lazy-append cdr ( lazy-append -- cdr ) M: lazy-append nil? ( lazy-append -- bool ) drop f ; -M: lazy-append list? ( object -- bool ) - drop t ; - TUPLE: lazy-from-by n quot ; C: lfrom-by lazy-from-by ( n quot -- list ) @@ -331,9 +295,6 @@ M: lazy-from-by cdr ( lazy-from-by -- cdr ) M: lazy-from-by nil? ( lazy-from-by -- bool ) drop f ; -M: lazy-from-by list? ( object -- bool ) - drop t ; - TUPLE: lazy-zip list1 list2 ; C: lazy-zip @@ -351,9 +312,6 @@ M: lazy-zip cdr ( lazy-zip -- cdr ) M: lazy-zip nil? ( lazy-zip -- bool ) drop f ; -M: lazy-zip list? ( object -- bool ) - drop t ; - TUPLE: sequence-cons index seq ; C: sequence-cons @@ -376,9 +334,6 @@ M: sequence-cons cdr ( sequence-cons -- cdr ) M: sequence-cons nil? ( sequence-cons -- bool ) drop f ; -M: sequence-cons list? ( object -- bool ) - drop t ; - : >list ( object -- list ) { { [ dup sequence? ] [ 0 swap seq>list ] } @@ -419,9 +374,6 @@ M: lazy-concat nil? ( lazy-concat -- bool ) drop f ] if ; -M: lazy-concat list? ( object -- bool ) - drop t ; - : lcartesian-product ( list1 list2 -- result ) swap [ swap [ 2array ] lmap-with ] lmap-with lconcat ; @@ -492,3 +444,20 @@ M: lazy-io cdr ( lazy-io -- cdr ) M: lazy-io nil? ( lazy-io -- bool ) car not ; + +INSTANCE: cons list +INSTANCE: sequence-cons list +INSTANCE: memoized-cons list +INSTANCE: promise list +INSTANCE: lazy-io list +INSTANCE: lazy-concat list +INSTANCE: lazy-cons list +INSTANCE: lazy-map list +INSTANCE: lazy-map-with list +INSTANCE: lazy-take list +INSTANCE: lazy-append list +INSTANCE: lazy-from-by list +INSTANCE: lazy-zip list +INSTANCE: lazy-while list +INSTANCE: lazy-until list +INSTANCE: lazy-subset list From f04eb21ef5694afb0720db18108f8c8abf413f52 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 02:12:40 -0600 Subject: [PATCH 02/67] Load disassembler by default now that it works on Windows --- extra/help/handbook/handbook.factor | 11 ++++++++--- extra/tools/disassembler/disassembler-docs.factor | 12 ++++++++++++ extra/tools/disassembler/disassembler.factor | 9 +++------ extra/tools/memory/memory-docs.factor | 2 +- 4 files changed, 24 insertions(+), 10 deletions(-) create mode 100755 extra/tools/disassembler/disassembler-docs.factor mode change 100644 => 100755 extra/tools/disassembler/disassembler.factor mode change 100644 => 100755 extra/tools/memory/memory-docs.factor diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor index 9472e1f519..b6b992344d 100755 --- a/extra/help/handbook/handbook.factor +++ b/extra/help/handbook/handbook.factor @@ -161,15 +161,20 @@ ARTICLE: "io" "Input and output" { $subsection "io.timeouts" } ; ARTICLE: "tools" "Developer tools" -{ $subsection "tools.annotations" } -{ $subsection "tools.crossref" } +"Exploratory tools:" { $subsection "editor" } +{ $subsection "tools.crossref" } { $subsection "inspector" } +"Debugging tools:" +{ $subsection "tools.annotations" } +{ $subsection "tools.test" } { $subsection "meta-interpreter" } +"Performance tools:" { $subsection "tools.memory" } { $subsection "profiling" } -{ $subsection "tools.test" } { $subsection "timing" } +{ $subsection "tools.disassembler" } +"Deployment tools:" { $subsection "tools.deploy" } ; ARTICLE: "article-index" "Article index" diff --git a/extra/tools/disassembler/disassembler-docs.factor b/extra/tools/disassembler/disassembler-docs.factor new file mode 100755 index 0000000000..618413dcbd --- /dev/null +++ b/extra/tools/disassembler/disassembler-docs.factor @@ -0,0 +1,12 @@ +IN: tools.disassembler +USING: help.markup help.syntax ; + +HELP: disassemble +{ $values { "obj" "a word or a pair of addresses" } } +{ $description "Disassembles either a compiled word definition or an arbitrary memory range using " { $snippet "gdb" } "." } ; + +ARTICLE: "tools.disassembler" "Disassembling words" +"The " { $vocab-link "tools.disassembler" } " vocabulary integrates Factor with the GNU debugger (" { $snippet "gdb" } ") for viewing the assembly code generated by the compiler. It can be used on both Unix and Windows as long as a working copy of " { $snippet "gdb" } " is installed and available in the " { $snippet "PATH" } "." +{ $subsection disassemble } ; + +ABOUT: "tools.disassembler" diff --git a/extra/tools/disassembler/disassembler.factor b/extra/tools/disassembler/disassembler.factor old mode 100644 new mode 100755 index f9e6e284de..16ea58ac70 --- a/extra/tools/disassembler/disassembler.factor +++ b/extra/tools/disassembler/disassembler.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: io.files io words alien kernel math.parser alien.syntax io.launcher system assocs arrays sequences namespaces qualified -regexp system math sequences.lib windows.kernel32 ; +system math sequences.lib windows.kernel32 generator.fixup ; IN: tools.disassembler : in-file "gdb-in.txt" resource-path ; @@ -12,7 +12,7 @@ IN: tools.disassembler GENERIC: make-disassemble-cmd ( obj -- ) M: word make-disassemble-cmd - word-xt cell - 2array make-disassemble-cmd ; + word-xt code-format - 2array make-disassemble-cmd ; M: pair make-disassemble-cmd in-file [ @@ -30,12 +30,9 @@ M: pair make-disassemble-cmd ] { } make-assoc run-process drop out-file file-lines ; -: relevant? ( line -- ? ) - R/ 0x.*:.*/ matches? ; - : tabs>spaces ( str -- str' ) CHAR: \t CHAR: \s replace ; : disassemble ( word -- ) make-disassemble-cmd run-gdb - [ relevant? ] subset [ tabs>spaces ] map [ print ] each ; + [ tabs>spaces ] map [ print ] each ; diff --git a/extra/tools/memory/memory-docs.factor b/extra/tools/memory/memory-docs.factor old mode 100644 new mode 100755 index 939dda0cfc..11bb8d859b --- a/extra/tools/memory/memory-docs.factor +++ b/extra/tools/memory/memory-docs.factor @@ -17,7 +17,7 @@ ARTICLE: "tools.memory" "Object memory tools" "The garbage collector can be invoked manually:" { $subsection data-gc } { $subsection code-gc } -{ $see-also "image" } ; +{ $see-also "images" } ; ABOUT: "tools.memory" From 3409aa670d17ffed5e89badeb7f01fcbb0ed82c0 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 02:21:01 -0600 Subject: [PATCH 03/67] builder.util: simpler cat and eval-file --- extra/builder/util/util.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/builder/util/util.factor b/extra/builder/util/util.factor index b3b88874b0..70f3083f57 100644 --- a/extra/builder/util/util.factor +++ b/extra/builder/util/util.factor @@ -69,9 +69,9 @@ TUPLE: process* arguments stdin stdout stderr timeout ; : milli-seconds>time ( n -- string ) 1000 /i 60 /mod >r 60 /mod r> 3array [ pad-00 ] map ":" join ; -: eval-file ( file -- obj ) contents eval ; +: eval-file ( file -- obj ) file-contents eval ; -: cat ( file -- ) contents print ; +: cat ( file -- ) file-contents print ; : run-or-bail ( desc quot -- ) [ [ try-process ] curry ] From 51a589835ee3b61d4e9224f19fc2345e1410f446 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 02:37:26 -0600 Subject: [PATCH 04/67] Minor tweaks --- extra/benchmark/compiler/compiler.factor | 17 +++++++++++++++++ extra/bootstrap/tools/tools.factor | 3 ++- .../tools/disassembler/disassembler-docs.factor | 5 +++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100755 extra/benchmark/compiler/compiler.factor diff --git a/extra/benchmark/compiler/compiler.factor b/extra/benchmark/compiler/compiler.factor new file mode 100755 index 0000000000..12ac9b8041 --- /dev/null +++ b/extra/benchmark/compiler/compiler.factor @@ -0,0 +1,17 @@ +IN: benchmark.compiler +USING: assocs words sequences arrays compiler tools.time +io.styles io prettyprint vocabs kernel sorting generator +optimizer ; + +: recompile-with-timings + all-words [ compiled? ] subset + [ dup [ word-dataflow optimize nip drop ] benchmark nip ] { } map>assoc + sort-values 20 tail* + "Worst offenders:" print + standard-table-style + [ + [ [ "Word" write ] with-cell [ "Compile time (ms)" write ] with-cell ] with-row + [ [ [ pprint-cell ] each ] with-row ] each + ] tabular-output ; + +MAIN: recompile-with-timings diff --git a/extra/bootstrap/tools/tools.factor b/extra/bootstrap/tools/tools.factor index 7b909ea1f6..40d77e03be 100755 --- a/extra/bootstrap/tools/tools.factor +++ b/extra/bootstrap/tools/tools.factor @@ -4,10 +4,11 @@ USING: vocabs.loader sequences ; "bootstrap.image" "tools.annotations" "tools.crossref" - ! "tools.deploy" + "tools.deploy" "tools.memory" "tools.profiler" "tools.test" "tools.time" + "tools.disassembler" "editors" } [ require ] each diff --git a/extra/tools/disassembler/disassembler-docs.factor b/extra/tools/disassembler/disassembler-docs.factor index 618413dcbd..f03861a8ed 100755 --- a/extra/tools/disassembler/disassembler-docs.factor +++ b/extra/tools/disassembler/disassembler-docs.factor @@ -1,9 +1,10 @@ IN: tools.disassembler -USING: help.markup help.syntax ; +USING: help.markup help.syntax sequences.private ; HELP: disassemble { $values { "obj" "a word or a pair of addresses" } } -{ $description "Disassembles either a compiled word definition or an arbitrary memory range using " { $snippet "gdb" } "." } ; +{ $description "Disassembles either a compiled word definition or an arbitrary memory range (in the case " { $snippet "obj" } " is a pair of integers) by attaching " { $snippet "gdb" } " to the Factor VM and capturing the output." } +{ $notes "In some cases the Factor compiler emits data inline with code, which can confuse " { $snippet "gdb" } ". This occurs in words which call " { $link dispatch } ", where the jump table addresses are compiled inline. Also on the ARM architecture, various pointers are often compiled inline, and the preceeding instruction jumps over the inline pinter." } ; ARTICLE: "tools.disassembler" "Disassembling words" "The " { $vocab-link "tools.disassembler" } " vocabulary integrates Factor with the GNU debugger (" { $snippet "gdb" } ") for viewing the assembly code generated by the compiler. It can be used on both Unix and Windows as long as a working copy of " { $snippet "gdb" } " is installed and available in the " { $snippet "PATH" } "." From 978a4e28ebad25adc76e5d145222b4bf3855535c Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 03:17:30 -0600 Subject: [PATCH 05/67] builder: minor tweaks --- extra/builder/builder.factor | 16 +++++++++++++--- extra/builder/util/util.factor | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index 00e39be2ba..572cd6d52c 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -69,13 +69,19 @@ VAR: stamp ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +SYMBOL: build-status + : (build) ( -- ) + build-status off + enter-build-dir "report" [ "Build machine: " write host-name print + "CPU: " write cpu print + "OS: " write os print "Build directory: " write cwd print git-clone [ "git clone failed" print ] run-or-bail @@ -88,7 +94,7 @@ VAR: stamp make-vm [ "vm compile error" print "../compile-log" cat ] run-or-bail - [ my-arch download-image ] [ "Image download error" print throw ] recover + [ retrieve-image ] [ "Image download error" print throw ] recover bootstrap [ "Bootstrap error" print "../boot-log" cat ] run-or-bail @@ -106,7 +112,9 @@ VAR: stamp "Benchmarks: " print "../benchmarks" [ stdio get contents eval ] with-file-in benchmarks. - ] with-file-out ; + ] with-file-out + + build-status on ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -114,12 +122,14 @@ SYMBOL: builder-recipients : tag-subject ( str -- str ) { "builder@" host-name* ": " , } bake to-string ; +: subject ( -- str ) build-status get [ "report" ] [ "error" ] if ; + : build ( -- ) [ (build) ] [ drop ] recover "ed@factorcode.org" >>from builder-recipients get >>to - "report" tag-subject >>subject + subject >>subject "../report" file>string >>body send ; diff --git a/extra/builder/util/util.factor b/extra/builder/util/util.factor index 70f3083f57..f9f432a8f6 100644 --- a/extra/builder/util/util.factor +++ b/extra/builder/util/util.factor @@ -81,3 +81,6 @@ TUPLE: process* arguments stdin stdout stderr timeout ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +USING: bootstrap.image bootstrap.image.download io.streams.null ; + +: retrieve-image ( -- ) [ my-arch download-image ] with-null-stream ; \ No newline at end of file From 50b38b0ae2e749fddd8390b34526464d688800d6 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 05:22:52 -0600 Subject: [PATCH 06/67] builder: builds-dir variable and prepare-build-machine --- extra/builder/builder.factor | 39 +++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index 572cd6d52c..d502d0dfbd 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -11,6 +11,28 @@ IN: builder ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +SYMBOL: builds-dir + +: builds ( -- path ) + builds-dir get + home "/builds" append + or ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +! User also needs to set smtp-host and builder-recipients + +: prepare-build-machine ( -- ) + builds make-directory + builds cd + { "git" "clone" "git://factorcode.org/git/factor.git" } run-process drop ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: builds-check ( -- ) builds exists? not [ prepare-build-machine ] when ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + : git-clone ( -- desc ) { "git" "clone" "../factor" } ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -19,7 +41,7 @@ VAR: stamp : enter-build-dir ( -- ) datestamp >stamp - "/builds" cd + builds cd stamp> make-directory stamp> cd ; @@ -75,6 +97,8 @@ SYMBOL: build-status build-status off + builds-check + enter-build-dir "report" [ @@ -118,21 +142,26 @@ SYMBOL: build-status ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +SYMBOL: builder-from + SYMBOL: builder-recipients : tag-subject ( str -- str ) { "builder@" host-name* ": " , } bake to-string ; -: subject ( -- str ) build-status get [ "report" ] [ "error" ] if ; +: subject ( -- str ) build-status get [ "report" ] [ "error" ] if tag-subject ; -: build ( -- ) - [ (build) ] [ drop ] recover +: send-builder-email ( -- ) - "ed@factorcode.org" >>from + builder-from get >>from builder-recipients get >>to subject >>subject "../report" file>string >>body send ; +: build ( -- ) + [ (build) ] [ drop ] recover + [ send-builder-email ] [ "not sending mail" . ] recover ; + ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! : git-pull ( -- desc ) From 8d86b51e76a89971dbb50011aa7155b631dd7c37 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 05:54:19 -0600 Subject: [PATCH 07/67] builder: do builds-check in build-loop --- extra/builder/builder.factor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index d502d0dfbd..e6e1c4d94f 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -97,8 +97,6 @@ SYMBOL: build-status build-status off - builds-check - enter-build-dir "report" [ @@ -160,7 +158,7 @@ SYMBOL: builder-recipients : build ( -- ) [ (build) ] [ drop ] recover - [ send-builder-email ] [ "not sending mail" . ] recover ; + [ send-builder-email ] [ drop "not sending mail" . ] recover ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -180,6 +178,7 @@ SYMBOL: builder-recipients = not ; : build-loop ( -- ) + builds-check [ "/builds/factor" cd updates-available? From da142685372f643d8669d4b6fae4f5387313971f Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 05:57:44 -0600 Subject: [PATCH 08/67] builder: minor fix --- extra/builder/builder.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index e6e1c4d94f..a13392699a 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -180,7 +180,7 @@ SYMBOL: builder-recipients : build-loop ( -- ) builds-check [ - "/builds/factor" cd + builds cd updates-available? [ build ] when From 9a66a8f87b43d9099cfa7da223d985aae77a20a4 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 06:04:53 -0600 Subject: [PATCH 09/67] builder: fix another bug --- extra/builder/builder.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index a13392699a..84a3d6d66e 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -180,7 +180,7 @@ SYMBOL: builder-recipients : build-loop ( -- ) builds-check [ - builds cd + builds "/factor" append cd updates-available? [ build ] when From bdbd6365324d04bf4ecbfce7a38e3fde35d75f42 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Fri, 15 Feb 2008 07:46:20 -0600 Subject: [PATCH 10/67] builder: fix report formatting --- extra/builder/builder.factor | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index 84a3d6d66e..d491e1650b 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -20,8 +20,6 @@ SYMBOL: builds-dir ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! User also needs to set smtp-host and builder-recipients - : prepare-build-machine ( -- ) builds make-directory builds cd @@ -104,7 +102,7 @@ SYMBOL: build-status "Build machine: " write host-name print "CPU: " write cpu print "OS: " write os print - "Build directory: " write cwd print + "Build directory: " write cwd print nl git-clone [ "git clone failed" print ] run-or-bail @@ -126,7 +124,7 @@ SYMBOL: build-status "Boot time: " write "../boot-time" eval-file milli-seconds>time print "Load time: " write "../load-time" eval-file milli-seconds>time print - "Test time: " write "../test-time" eval-file milli-seconds>time print + "Test time: " write "../test-time" eval-file milli-seconds>time print nl "Did not pass load-everything: " print "../load-everything-vocabs" cat "Did not pass test-all: " print "../test-all-vocabs" cat From 97fd5bee5fa1a66d42c638cac0b89ffc926e7483 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sat, 16 Feb 2008 09:05:01 -0600 Subject: [PATCH 11/67] builder: (build) does builds-check --- extra/builder/builder.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra/builder/builder.factor b/extra/builder/builder.factor index d491e1650b..cd17a32255 100644 --- a/extra/builder/builder.factor +++ b/extra/builder/builder.factor @@ -93,6 +93,8 @@ SYMBOL: build-status : (build) ( -- ) + builds-check + build-status off enter-build-dir From 46df9c16d19dcdbc315492051720ef17e29351c9 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 15 Feb 2008 12:16:31 -0600 Subject: [PATCH 12/67] fix load error --- extra/db/postgresql/postgresql.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/db/postgresql/postgresql.factor b/extra/db/postgresql/postgresql.factor index f198a5c04c..f0a008d065 100755 --- a/extra/db/postgresql/postgresql.factor +++ b/extra/db/postgresql/postgresql.factor @@ -52,6 +52,9 @@ M: postgresql-result-set #columns ( result-set -- n ) M: postgresql-result-set row-column ( result-set n -- obj ) >r dup result-set-handle swap result-set-n r> PQgetvalue ; +M: postgresql-result-set row-column ( result-set n -- obj ) + >r dup result-set-handle swap result-set-n r> PQgetvalue ; + M: postgresql-statement insert-statement ( statement -- id ) query-results [ break 0 row-column ] with-disposal ; @@ -234,9 +237,6 @@ M: postgresql-db tuple>params ( columns tuple -- obj ) [ >r dup third swap first r> get-slot-named swap ] curry { } map>assoc ; -M: postgresql-db last-id ( res -- id ) - drop f ; - : postgresql-db-modifiers ( -- hashtable ) H{ { +native-id+ "not null primary key" } From d8e7f0c84ad41d95c91c9998efbaa1fb208caa97 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 15 Feb 2008 14:01:44 -0600 Subject: [PATCH 13/67] add type conversion to the database library for sqlite and postgresql --- extra/db/postgresql/postgresql.factor | 15 ++++++++++++--- extra/db/sqlite/ffi/ffi.factor | 2 ++ extra/db/sqlite/lib/lib.factor | 8 ++++++++ extra/db/sqlite/sqlite.factor | 3 +++ extra/db/tuples/tuples.factor | 3 +++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/extra/db/postgresql/postgresql.factor b/extra/db/postgresql/postgresql.factor index f0a008d065..50704ea974 100755 --- a/extra/db/postgresql/postgresql.factor +++ b/extra/db/postgresql/postgresql.factor @@ -3,7 +3,8 @@ USING: arrays assocs alien alien.syntax continuations io kernel math math.parser namespaces prettyprint quotations sequences debugger db db.postgresql.lib db.postgresql.ffi -db.tuples db.types tools.annotations math.ranges ; +db.tuples db.types tools.annotations math.ranges +combinators ; IN: db.postgresql TUPLE: postgresql-db host port pgopts pgtty db user pass ; @@ -52,8 +53,16 @@ M: postgresql-result-set #columns ( result-set -- n ) M: postgresql-result-set row-column ( result-set n -- obj ) >r dup result-set-handle swap result-set-n r> PQgetvalue ; -M: postgresql-result-set row-column ( result-set n -- obj ) - >r dup result-set-handle swap result-set-n r> PQgetvalue ; +M: postgresql-result-set row-column-typed ( result-set n type -- obj ) + >r row-column r> sql-type>factor-type ; + +M: postgresql-result-set sql-type>factor-type ( obj type -- newobj ) + { + { INTEGER [ string>number ] } + { BIG_INTEGER [ string>number ] } + { DOUBLE [ string>number ] } + [ drop ] + } case ; M: postgresql-statement insert-statement ( statement -- id ) query-results [ break 0 row-column ] with-disposal ; diff --git a/extra/db/sqlite/ffi/ffi.factor b/extra/db/sqlite/ffi/ffi.factor index 3d37348709..8c957108e1 100755 --- a/extra/db/sqlite/ffi/ffi.factor +++ b/extra/db/sqlite/ffi/ffi.factor @@ -125,6 +125,8 @@ FUNCTION: void* sqlite3_column_blob ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: int sqlite3_column_bytes ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: char* sqlite3_column_decltype ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: int sqlite3_column_int ( sqlite3_stmt* pStmt, int col ) ; +FUNCTION: sqlite3_int64 sqlite3_column_int64 ( sqlite3_stmt* pStmt, int col ) ; +FUNCTION: double sqlite3_column_double ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: int sqlite3_column_name ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: char* sqlite3_column_text ( sqlite3_stmt* pStmt, int col ) ; FUNCTION: int sqlite3_column_type ( sqlite3_stmt* pStmt, int col ) ; diff --git a/extra/db/sqlite/lib/lib.factor b/extra/db/sqlite/lib/lib.factor index dfa8a4b2dc..85aa671d4d 100755 --- a/extra/db/sqlite/lib/lib.factor +++ b/extra/db/sqlite/lib/lib.factor @@ -96,6 +96,14 @@ IN: db.sqlite.lib : sqlite-column ( handle index -- string ) sqlite3_column_text ; +: sqlite-column-typed ( handle index type -- obj ) + { + { INTEGER [ sqlite3_column_int ] } + { BIG_INTEGER [ sqlite3_column_int64 ] } + { TEXT [ sqlite3_column_text ] } + { DOUBLE [ sqlite3_column_double ] } + } case ; + ! TODO : sqlite-row ( handle -- seq ) dup sqlite-#columns [ sqlite-column ] with map ; diff --git a/extra/db/sqlite/sqlite.factor b/extra/db/sqlite/sqlite.factor index 298220b3ca..5e1bf0fa6f 100755 --- a/extra/db/sqlite/sqlite.factor +++ b/extra/db/sqlite/sqlite.factor @@ -63,6 +63,9 @@ M: sqlite-result-set #columns ( result-set -- n ) M: sqlite-result-set row-column ( result-set n -- obj ) >r result-set-handle r> sqlite-column ; +M: sqlite-result-set row-column-typed ( result-set n type -- obj ) + >r result-set-handle r> sqlite-column-typed ; + M: sqlite-result-set advance-row ( result-set -- ) [ result-set-handle sqlite-next ] keep set-sqlite-result-set-has-more? ; diff --git a/extra/db/tuples/tuples.factor b/extra/db/tuples/tuples.factor index 74726f12aa..9b94c16672 100755 --- a/extra/db/tuples/tuples.factor +++ b/extra/db/tuples/tuples.factor @@ -46,6 +46,9 @@ HOOK: update-sql* db ( columns table -- sql ) HOOK: delete-sql* db ( columns table -- sql ) HOOK: select-sql* db ( columns table -- sql ) +HOOK: row-column-typed db ( result-set n type -- sql ) +HOOK: sql-type>factor-type db ( obj type -- obj ) + : insert-sql ( columns class -- statement ) db get db-insert-statements [ insert-sql* ] cache-statement ; From be9989cf3d82659cee4814cce10093880b170faf Mon Sep 17 00:00:00 2001 From: sheeple Date: Fri, 15 Feb 2008 14:16:28 -0600 Subject: [PATCH 14/67] More efficient io.unix.select --- extra/io/unix/select/select.factor | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/extra/io/unix/select/select.factor b/extra/io/unix/select/select.factor index 06e257a610..9827d4d54f 100755 --- a/extra/io/unix/select/select.factor +++ b/extra/io/unix/select/select.factor @@ -17,14 +17,18 @@ TUPLE: select-mx read-fdset write-fdset ; FD_SETSIZE 8 * over set-select-mx-read-fdset FD_SETSIZE 8 * over set-select-mx-write-fdset ; +: clear-nth ( n seq -- ? ) + [ nth ] 2keep f -rot set-nth ; + : handle-fd ( fd task fdset mx -- ) - roll munge rot nth [ swap handle-io-task ] [ 2drop ] if ; + roll munge rot clear-nth + [ swap handle-io-task ] [ 2drop ] if ; : handle-fdset ( tasks fdset mx -- ) [ handle-fd ] 2curry assoc-each ; : init-fdset ( tasks fdset -- ) - dup clear-bits + ! dup clear-bits [ >r drop t swap munge r> set-nth ] curry assoc-each ; : read-fdset/tasks @@ -33,13 +37,19 @@ TUPLE: select-mx read-fdset write-fdset ; : write-fdset/tasks { mx-writes select-mx-write-fdset } get-slots ; -: init-fdsets ( mx -- read write except ) +: max-fd dup assoc-empty? [ drop 0 ] [ keys supremum ] if ; + +: num-fds ( mx -- n ) + dup mx-reads max-fd swap mx-writes max-fd max 1+ ; + +: init-fdsets ( mx -- nfds read write except ) + [ num-fds ] keep [ read-fdset/tasks tuck init-fdset ] keep write-fdset/tasks tuck init-fdset f ; M: select-mx wait-for-events ( ms mx -- ) - swap >r FD_SETSIZE over init-fdsets r> make-timeval + swap >r dup init-fdsets r> make-timeval select multiplexer-error dup read-fdset/tasks pick handle-fdset dup write-fdset/tasks rot handle-fdset ; From 9faee652c89bdf852412359c9aa19b6cc66f8f8b Mon Sep 17 00:00:00 2001 From: sheeple Date: Fri, 15 Feb 2008 14:16:45 -0600 Subject: [PATCH 15/67] vocabs-profile. now omits type predicates --- extra/tools/profiler/profiler.factor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extra/tools/profiler/profiler.factor b/extra/tools/profiler/profiler.factor index 4702431a8f..c35d5a72c8 100755 --- a/extra/tools/profiler/profiler.factor +++ b/extra/tools/profiler/profiler.factor @@ -59,5 +59,7 @@ M: string (profile.) : vocabs-profile. ( -- ) "Call counts for all vocabularies:" print vocabs [ - dup words [ profile-counter ] map sum + dup words + [ "predicating" word-prop not ] subset + [ profile-counter ] map sum ] { } map>assoc counters. ; From da716ed6ec7196fddcf3fc8a86b89bf85cc755dc Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:04:47 -0600 Subject: [PATCH 16/67] Rename benchmark.compiler to optimizer.report --- extra/benchmark/compiler/compiler.factor | 17 -------------- extra/optimizer/report/report.factor | 28 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 17 deletions(-) delete mode 100755 extra/benchmark/compiler/compiler.factor create mode 100755 extra/optimizer/report/report.factor diff --git a/extra/benchmark/compiler/compiler.factor b/extra/benchmark/compiler/compiler.factor deleted file mode 100755 index 12ac9b8041..0000000000 --- a/extra/benchmark/compiler/compiler.factor +++ /dev/null @@ -1,17 +0,0 @@ -IN: benchmark.compiler -USING: assocs words sequences arrays compiler tools.time -io.styles io prettyprint vocabs kernel sorting generator -optimizer ; - -: recompile-with-timings - all-words [ compiled? ] subset - [ dup [ word-dataflow optimize nip drop ] benchmark nip ] { } map>assoc - sort-values 20 tail* - "Worst offenders:" print - standard-table-style - [ - [ [ "Word" write ] with-cell [ "Compile time (ms)" write ] with-cell ] with-row - [ [ [ pprint-cell ] each ] with-row ] each - ] tabular-output ; - -MAIN: recompile-with-timings diff --git a/extra/optimizer/report/report.factor b/extra/optimizer/report/report.factor new file mode 100755 index 0000000000..6655d9dcf3 --- /dev/null +++ b/extra/optimizer/report/report.factor @@ -0,0 +1,28 @@ +IN: optimizer.report +USING: assocs words sequences arrays compiler tools.time +io.styles io prettyprint vocabs kernel sorting generator +optimizer ; + +: count-optimization-passes ( nodes n -- n ) + >r optimize-1 + [ r> 1+ count-optimization-passes ] [ drop r> ] if ; + +: word-table + [ [ second ] swap compose compare ] curry sort 20 tail* + print + standard-table-style + [ + [ [ [ pprint-cell ] each ] with-row ] each + ] tabular-output ; + +: optimizer-report + all-words [ compiled? ] subset + [ + dup [ + word-dataflow nip 1 count-optimization-passes + ] benchmark nip 2array + ] { } map>assoc + [ first ] "Worst number of optimizer passes:" results + [ second ] "Worst compile times:" results ; + +MAIN: optimizer-report From 89e97fc89a03dcac41983b0ba0f9870bdf21c967 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:06:48 -0600 Subject: [PATCH 17/67] Debugger unit test for recent regression --- core/debugger/debugger-tests.factor | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 core/debugger/debugger-tests.factor diff --git a/core/debugger/debugger-tests.factor b/core/debugger/debugger-tests.factor new file mode 100755 index 0000000000..31c3e8a762 --- /dev/null +++ b/core/debugger/debugger-tests.factor @@ -0,0 +1,4 @@ +IN: temporary +USING: debugger kernel continuations tools.test ; + +[ ] [ [ drop ] [ error. ] recover ] unit-test From a4c3e8bda04f779d88a6311eeaf4de460acb6959 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:07:10 -0600 Subject: [PATCH 18/67] Load handbook last --- extra/bootstrap/handbook/handbook.factor | 3 + extra/bootstrap/help/help.factor | 4 +- extra/help/handbook/handbook.factor | 142 +---------------------- 3 files changed, 9 insertions(+), 140 deletions(-) create mode 100755 extra/bootstrap/handbook/handbook.factor diff --git a/extra/bootstrap/handbook/handbook.factor b/extra/bootstrap/handbook/handbook.factor new file mode 100755 index 0000000000..2ffb77de7a --- /dev/null +++ b/extra/bootstrap/handbook/handbook.factor @@ -0,0 +1,3 @@ +USING: vocabs.loader vocabs kernel ; + +"bootstrap.help" vocab [ "help.handbook" require ] when diff --git a/extra/bootstrap/help/help.factor b/extra/bootstrap/help/help.factor index ade60d4457..1680278fad 100755 --- a/extra/bootstrap/help/help.factor +++ b/extra/bootstrap/help/help.factor @@ -14,8 +14,6 @@ IN: bootstrap.help [ vocab-root ] subset [ vocab-source-loaded? ] subset [ dup vocab-docs-loaded? [ drop ] [ load-docs ] if ] each - ] with-variable - - "help.handbook" require ; + ] with-variable ; load-help diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor index b6b992344d..90e780c1ad 100755 --- a/extra/help/handbook/handbook.factor +++ b/extra/help/handbook/handbook.factor @@ -1,8 +1,8 @@ -USING: help help.markup help.syntax help.topics -namespaces words sequences classes assocs vocabs kernel -arrays prettyprint.backend kernel.private io tools.browser -generic math tools.profiler system ui strings sbufs vectors -byte-arrays bit-arrays float-arrays quotations help.lint ; +USING: help help.markup help.syntax help.definitions help.topics +namespaces words sequences classes assocs vocabs kernel arrays +prettyprint.backend kernel.private io generic math system +strings sbufs vectors byte-arrays bit-arrays float-arrays +quotations ; IN: help.handbook ARTICLE: "conventions" "Conventions" @@ -206,7 +206,6 @@ ARTICLE: "handbook" "Factor documentation" { $subsection "cookbook" } { $subsection "first-program" } { $subsection "vocab-index" } -{ $subsection "changes" } { $heading "Language reference" } { $subsection "conventions" } { $subsection "syntax" } @@ -236,137 +235,6 @@ ARTICLE: "handbook" "Factor documentation" { $subsection "type-index" } { $subsection "class-index" } ; - -USING: io.files io.sockets float-arrays inference ; - -ARTICLE: "changes" "Changes in the latest release" -{ $heading "Factor 0.91" } -{ $subheading "Performance" } -{ $list - { "Continuations are now supported by the static stack effect system. This means that the " { $link infer } " word and the optimizing compiler now both support code which uses continuations." } - { "Many words which previously ran in the interpreter, such as error handling and I/O, are now compiled to optimized machine code." } - { "A non-optimizing, just-in-time compiler replaces the interpreter with no loss in functionality or introspective ability." } - { "The non-optimizing compiler compiles quotations the first time they are called, generating a series of stack pushes and subroutine calls. It offers a 33%-50% performance increase over the interpreter." } - { "The optimizing compiler now performs some more representation inference. Alien pointers are unboxed where possible. This improves performance of the " { $vocab-link "ogg.player" } " Ogg Theora video player." } - { "The queue of sleeping tasks is now a sorted priority queue. This reduces overhead for workloads involving large numbers of sleeping threads (Doug Coleman)" } - { "Improved hash code algorithm for sequences" } - { "New, efficient implementations of " { $link bit? } " and " { $link log2 } " runs in constant time for large bignums" } - { "New " { $link big-random } " word for generating large random numbers quickly" } - { "Improved profiler no longer has to be explicitly enabled and disabled with a full recompile; instead, the " { $link profile } " word can be used at any time, and it dynamically patches words to increment call counts. There is no overhead when the profiler is not in use." } - { "Calls to " { $link member? } " with a literal sequence are now open-coded. If there are four or fewer elements, a series of conditionals are generated; if there are more than four elements, there is a hash dispatch followed by conditionals in each branch." } -} -{ $subheading "IO" } -{ $list - { "More robust Windows CE native I/O" } - { "New " { $link os-envs } " word to get the current set of environment variables" } - { "Redesigned " { $vocab-link "io.launcher" } " supports passing environment variables to the child process" } - { { $link } " implemented on Windows (Doug Coleman)" } - { "Updated " { $vocab-link "io.mmap" } " for new module system, now supports Windows CE (Doug Coleman)" } - { { $vocab-link "io.sniffer" } " - packet sniffer library (Doug Coleman, Elie Chaftari)" } - { { $vocab-link "io.server" } " - improved logging support, logs to a file by default" } - { { $vocab-link "io.files" } " - several new file system manipulation words added" } - { { $vocab-link "tar" } " - tar file extraction in pure Factor (Doug Coleman)" } - { { $vocab-link "unix.linux" } ", " { $vocab-link "raptor" } " - ``Raptor Linux'', a set of alien bindings to low-level Linux features, such as network interface configuration, file system mounting/unmounting, etc, together with experimental boot scripts intended to entirely replace " { $snippet "/sbin/init" } ", " { $snippet "/etc/inittab" } " and " { $snippet "/etc/init.d/" } " (Eduardo Cavazos)." } -} -{ $subheading "Tools" } -{ $list - { "Graphical deploy tool added - see " { $link "ui.tools.deploy" } } - { "The deploy tool now supports Windows" } - { { $vocab-link "network-clipboard" } " - clipboard synchronization with a simple TCP/IP protocol" } -} -{ $subheading "UI" } -{ $list - { { $vocab-link "cairo" } " - updated for new module system, new features (Sampo Vuori)" } - { { $vocab-link "springies" } " - physics simulation UI demo (Eduardo Cavazos)" } - { { $vocab-link "ui.gadgets.buttons" } " - added check box and radio button gadgets" } - { "Double- and triple-click-drag now supported in the editor gadget to select words or lines at a time" } - { "Windows can be closed on request now using " { $link close-window } } - { "New icons (Elie Chaftari)" } -} -{ $subheading "Libraries" } -{ $list - { "The " { $snippet "queues" } " vocabulary has been removed because its functionality is a subset of " { $vocab-link "dlists" } } - { "The " { $vocab-link "webapps.cgi" } " vocabulary implements CGI support for the Factor HTTP server." } - { "The optimizing compiler no longer depends on the number tower and it is possible to bootstrap a minimal image by just passing " { $snippet "-include=compiler" } " to stage 2 bootstrap." } - { { $vocab-link "benchmark.knucleotide" } " - new benchmark (Eric Mertens)" } - { { $vocab-link "channels" } " - concurrent message passing over message channels" } - { { $vocab-link "destructors" } " - deterministic scope-based resource deallocation (Doug Coleman)" } - { { $vocab-link "dlists" } " - various updates (Doug Coleman)" } - { { $vocab-link "editors.emeditor" } " - EmEditor integration (Doug Coleman)" } - { { $vocab-link "editors.editplus" } " - EditPlus integration (Aaron Schaefer)" } - { { $vocab-link "editors.notepadpp" } " - Notepad++ integration (Doug Coleman)" } - { { $vocab-link "editors.ted-notepad" } " - TED Notepad integration (Doug Coleman)" } - { { $vocab-link "editors.ultraedit" } " - UltraEdit integration (Doug Coleman)" } - { { $vocab-link "globs" } " - simple Unix shell-style glob patterns" } - { { $vocab-link "heaps" } " - updated for new module system and cleaned up (Doug Coleman)" } - { { $vocab-link "peg" } " - Parser Expression Grammars, a new appoach to parser construction, similar to parser combinators (Chris Double)" } - { { $vocab-link "regexp" } " - revived from " { $snippet "unmaintained/" } " and completely redesigned (Doug Coleman)" } - { { $vocab-link "rss" } " - add Atom feed generation (Daniel Ehrenberg)" } - { { $vocab-link "tuples.lib" } " - some utility words for working with tuples (Doug Coleman)" } - { { $vocab-link "webapps.pastebin" } " - improved appearance, add Atom feed generation, add syntax highlighting using " { $vocab-link "xmode" } } - { { $vocab-link "webapps.planet" } " - add Atom feed generation" } -} -{ $heading "Factor 0.90" } -{ $subheading "Core" } -{ $list - { "New module system; see " { $link "vocabs.loader" } ". (Eduardo Cavazos)" } - { "Tuple constructors are defined differently now; see " { $link "tuple-constructors" } "." } - { "Mixin classes implemented; these are essentially extensible unions. See " { $link "mixins" } "." } - { "New " { $link float-array } " data type implements a space-efficient sequence of floats." } - { "Moved " { $link } ", " { $link delete-file } ", " { $link make-directory } ", " { $link delete-directory } " words from " { $snippet "libs/io" } " into the core, and fixed them to work on more platforms." } - { "New " { $link host-name } " word." } - { "The " { $link directory } " word now outputs an array of pairs, with the second element of each pair indicating if that entry is a subdirectory. This saves an unnecessary " { $link stat } " call when traversing directory hierarchies, which speeds things up." } - { "IPv6 is now supported, along with Unix domain sockets (the latter on Unix systems only). The stack effects of " { $link } " and " { $link } " have changed, since they now take generic address specifiers; see " { $link "network-streams" } "." } - { "The stage 2 bootstrap process is more flexible, and various subsystems such as help, tools and the UI can be omitted by supplying command line switches; see " { $link "bootstrap-cli-args" } "." } - { "The " { $snippet "-shell" } " command line switch has been replaced by a " { $snippet "-run" } " command line switch; see " { $link "standard-cli-args" } "." } - { "Variable usage inference has been removed; the " { $link infer } " word no longer reports this information." } - -} -{ $subheading "Tools" } -{ $list - { "Stand-alone image deployment; see " { $link "tools.deploy" } "." } - { "Stand-alone application bundle deployment on Mac OS X; see " { $vocab-link "tools.deploy.app" } "." } - { "New vocabulary browser tool in the UI." } - { "New profiler tool in the UI." } -} -{ $subheading "Extras" } -"Most existing libraries were improved when ported to the new module system; the most notable changes include:" -{ $list - { { $vocab-link "asn1" } ": ASN1 parser and writer. (Elie Chaftari)" } - { { $vocab-link "benchmark" } ": new set of benchmarks." } - { { $vocab-link "cfdg" } ": Context-free design grammar implementation; see " { $url "http://www.chriscoyne.com/cfdg/" } ". (Eduardo Cavazos)" } - { { $vocab-link "cryptlib" } ": Cryptlib library binding. (Elie Chaftari)" } - { { $vocab-link "cryptlib.streams" } ": Streams which perform SSL encryption and decryption. (Matthew Willis)" } - { { $vocab-link "hints" } ": Give type specialization hints to the compiler." } - { { $vocab-link "inverse" } ": Invertible computation and concatenative pattern matching. (Daniel Ehrenberg)" } - { { $vocab-link "ldap" } ": OpenLDAP library binding. (Elie Chaftari)" } - { { $vocab-link "locals" } ": Efficient lexically scoped locals, closures, and local words." } - { { $vocab-link "mortar" } ": Experimental message-passing object system. (Eduardo Cavazos)" } - { { $vocab-link "openssl" } ": OpenSSL library binding. (Elie Chaftari)" } - { { $vocab-link "pack" } ": Utility for reading and writing binary data. (Doug Coleman)" } - { { $vocab-link "pdf" } ": Haru PDF library binding. (Elie Chaftari)" } - { { $vocab-link "qualified" } ": Refer to words from another vocabulary without adding the entire vocabulary to the search path. (Daniel Ehrenberg)" } - { { $vocab-link "roman" } ": Reading and writing Roman numerals. (Doug Coleman)" } - { { $vocab-link "scite" } ": SciTE editor integration. (Clemens Hofreither)" } - { { $vocab-link "smtp" } ": SMTP client with support for CRAM-MD5 authentication. (Elie Chaftari, Dirk Vleugels)" } - { { $vocab-link "tuple-arrays" } ": Space-efficient packed tuple arrays. (Daniel Ehrenberg)" } - { { $vocab-link "unicode" } ": major new functionality added. (Daniel Ehrenberg)" } -} -{ $subheading "Performance" } -{ $list - { "The " { $link curry } " word now runs in constant time, and curried quotations can be called from compiled code; this allows for abstractions and idioms which were previously impractical due to performance issues. In particular, words such as " { $snippet "each-with" } " and " { $snippet "map-with" } " are gone; " { $snippet "each-with" } " can now be written as " { $snippet "with each" } ", and similarly for other " { $snippet "-with" } " combinators." } - "Improved generational promotion strategy in garbage collector reduces the amount of junk which makes its way into tenured space, which in turn reduces the frequency of full garbage collections." - "Faster generic word dispatch and union membership testing." - { "Alien memory accessors (" { $link "reading-writing-memory" } ") are compiled as intrinsics where possible, which improves performance in code which iteroperates with C libraries." } -} -{ $subheading "Platforms" } -{ $list - "Networking support added for Windows CE. (Doug Coleman)" - "UDP/IP networking support added for all Windows platforms. (Doug Coleman)" - "Solaris/x86 fixes. (Samuel Tardieu)" - "Linux/AMD64 port works again." -} ; - { } related-words From 3694064f41fb79b51c09d22fc0bda84b6cb65d7b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:07:39 -0600 Subject: [PATCH 19/67] Better optimizer.debugger --- extra/optimizer/debugger/debugger.factor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extra/optimizer/debugger/debugger.factor b/extra/optimizer/debugger/debugger.factor index db65a678cf..3cbddf8296 100755 --- a/extra/optimizer/debugger/debugger.factor +++ b/extra/optimizer/debugger/debugger.factor @@ -4,7 +4,7 @@ USING: classes inference inference.dataflow io kernel kernel.private math.parser namespaces optimizer prettyprint prettyprint.backend sequences words arrays match macros assocs sequences.private optimizer.specializers generic -combinators sorting math ; +combinators sorting math quotations ; IN: optimizer.debugger ! A simple tool for turning dataflow IR into quotations, for @@ -67,7 +67,7 @@ M: #shuffle node>quot [ , ] [ >r drop t r> ] if* dup effect-str "#shuffle: " swap append comment, ; -: pushed-literals node-out-d [ value-literal ] map ; +: pushed-literals node-out-d [ value-literal literalize ] map ; M: #push node>quot nip pushed-literals % ; @@ -83,6 +83,7 @@ M: #call-label node>quot #call>quot ; M: #label node>quot [ + dup node-param literalize , dup #label-loop? "#loop: " "#label: " ? over node-param word-name append comment, ] 2keep From f9c76689d6c3e4b48360de0b24bdacced749e2b8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:07:56 -0600 Subject: [PATCH 20/67] #loop optimization fixes --- core/generator/generator.factor | 29 ++-- core/optimizer/control/control-tests.factor | 35 ++++- core/optimizer/control/control.factor | 143 +++++++++++++------- 3 files changed, 139 insertions(+), 68 deletions(-) mode change 100644 => 100755 core/optimizer/control/control-tests.factor diff --git a/core/generator/generator.factor b/core/generator/generator.factor index e6a6226afa..3514947e3d 100755 --- a/core/generator/generator.factor +++ b/core/generator/generator.factor @@ -26,7 +26,7 @@ SYMBOL: compiling-word SYMBOL: compiling-label -SYMBOL: compiling-loop? +SYMBOL: compiling-loops ! Label of current word, after prologue, makes recursion faster SYMBOL: current-label-start @@ -34,7 +34,7 @@ SYMBOL: current-label-start : compiled-stack-traces? ( -- ? ) 36 getenv ; : begin-compiling ( word label -- ) - compiling-loop? off + H{ } clone compiling-loops set compiling-label set compiling-word set compiled-stack-traces? @@ -94,8 +94,8 @@ M: node generate-node drop iterate-next ; : generate-call ( label -- next ) dup maybe-compile end-basic-block - dup compiling-label get eq? compiling-loop? get and [ - drop current-label-start get %jump-label f + dup compiling-loops get at [ + %jump-label f ] [ tail-call? [ %jump f @@ -104,7 +104,7 @@ M: node generate-node drop iterate-next ; %call iterate-next ] if - ] if ; + ] ?if ; ! #label M: #label generate-node @@ -113,17 +113,13 @@ M: #label generate-node r> ; ! #loop +: compiling-loop ( word -- ) +