From b4683b1985bcb0ef075a3aa6b7d0b28fa4294af3 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 18 Aug 2006 05:35:04 +0000 Subject: [PATCH] Compiler fixes --- TODO.FACTOR.txt | 6 +++--- library/compiler/compiler.factor | 9 ++++++++- library/compiler/inference/words.factor | 2 +- library/test/compiler/optimizer.factor | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 6655da823f..0200c78e1d 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -12,7 +12,6 @@ - roundoff is still not quite right with tracks - fix top level window positioning - fix contribs: boids, automata -- graphical module manager tool - see if alien calls can be made faster - sometimes darcs get fails with the httpd - gdb triggers 'mutliple i/o ops on port' error @@ -52,6 +51,7 @@ + ui: +- graphical module manager tool - figure out what goes in the .app and what doesn't - should be possible to drop an image file on the .app to run it - the UI listener has a shitty design. perhaps it should not call out @@ -98,6 +98,8 @@ + compiler/ffi: +- compiler tests are not as reliable now because of try-compile usage + - we can just do [ t ] [ \ foo compiled? ] unit-test - [ [ dup call ] dup call ] infer hangs - callstack overflow when compiling mutually recursive inline words - test what is done in the case of an invalid declaration on an inline @@ -119,8 +121,6 @@ + misc: -- compiler tests are not as reliable now because of try-compile usage - - we can just do [ t ] [ \ foo compiled? ] unit-test - growable data heap - incremental GC - UDP diff --git a/library/compiler/compiler.factor b/library/compiler/compiler.factor index 74c07086bc..6c027df1c5 100644 --- a/library/compiler/compiler.factor +++ b/library/compiler/compiler.factor @@ -5,10 +5,17 @@ USING: errors generic hashtables inference io kernel math namespaces optimizer parser prettyprint sequences test threads words ; +: word-dataflow ( word -- dataflow ) + [ + dup dup add-recursive-state + dup specialized-def (dataflow) + swap current-effect check-effect + ] with-infer ; + : (compile) ( word -- ) dup compiling? not over compound? and [ "Compiling " write dup . flush - dup specialized-def dataflow optimize generate + dup word-dataflow optimize generate ] [ drop ] if ; diff --git a/library/compiler/inference/words.factor b/library/compiler/inference/words.factor index 4380374ab0..77cb25387e 100644 --- a/library/compiler/inference/words.factor +++ b/library/compiler/inference/words.factor @@ -158,7 +158,7 @@ M: symbol apply-object apply-literal ; #! Handle a recursive call, by either applying a previously #! inferred base case, or raising an error. If the recursive #! call is to a local block, emit a label call node. - dup "infer-effect" word-prop [ ] [ declared-effect ] if ; + dup "infer-effect" word-prop [ ] [ declared-effect ] ?if ; M: compound apply-object #! Apply the word's stack effect to the inferencer state. diff --git a/library/test/compiler/optimizer.factor b/library/test/compiler/optimizer.factor index ca7617e7e1..b95c9ae30b 100644 --- a/library/test/compiler/optimizer.factor +++ b/library/test/compiler/optimizer.factor @@ -135,7 +135,7 @@ USE: optimizer [ class-compare ] sort min-class ] unit-test -GENERIC: xyz +GENERIC: xyz ( obj -- obj ) M: array xyz xyz ; [ ] [ \ xyz compile ] unit-test @@ -220,7 +220,7 @@ TUPLE: pred-test ; [ 0 ] [ 10 double-label-2 ] unit-test ! regression -GENERIC: void-generic +GENERIC: void-generic ( obj -- * ) : breakage "hi" void-generic ; [ ] [ \ breakage compile ] unit-test [ breakage ] unit-test-fails