From aa8769c29dd6e98fd87f1f5aa3a94d73d0cbfccc Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Wed, 13 Feb 2008 20:19:18 -0600 Subject: [PATCH 01/15] 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/15] 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 51a589835ee3b61d4e9224f19fc2345e1410f446 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 02:37:26 -0600 Subject: [PATCH 03/15] 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 da716ed6ec7196fddcf3fc8a86b89bf85cc755dc Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Feb 2008 18:04:47 -0600 Subject: [PATCH 04/15] 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 05/15] 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 06/15] 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 07/15] 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 08/15] #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 -- ) +