diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index c26624ce0a..f3862f6490 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,5 +1,7 @@ should fix in 0.82: +- constant branch folding +- getenv, setenv, fast-slot stuff - 3 >n fep - amd64 %box-struct - get factor running on mac intel @@ -27,6 +29,7 @@ should fix in 0.82: + ui/help: +- polish OS X menu bar code - help search - reimplement clicking input - reimplement tab completion @@ -74,7 +77,6 @@ should fix in 0.82: - the invalid recursion form case needs to be fixed, for inlines too - code gc - compiled gc check slows things down -- fix branch folding + misc: diff --git a/library/compiler/stack.factor b/library/compiler/stack.factor index 4583328ad4..9666824bb7 100644 --- a/library/compiler/stack.factor +++ b/library/compiler/stack.factor @@ -8,8 +8,8 @@ namespaces prettyprint sequences vectors words ; 2dup length <= [ cut-phantom ] [ - [ phantom-locs ] keep [ length swap tail-slice ] keep - append + [ phantom-locs ] keep [ length swap head-slice* ] keep + [ append 0 ] keep set-length ] if ; : phantom-shuffle-inputs ( shuffle -- locs locs ) @@ -26,9 +26,9 @@ namespaces prettyprint sequences vectors words ; free-vregs get length <= ; : phantom-shuffle ( shuffle -- ) - ! compute-free-vregs sufficient-shuffle-vregs? [ + compute-free-vregs sufficient-shuffle-vregs? [ end-basic-block compute-free-vregs - ! ] unless + ] unless [ phantom-shuffle-inputs ] keep [ shuffle* ] keep adjust-shuffle (template-outputs) ; diff --git a/library/compiler/templates.factor b/library/compiler/templates.factor index 1126c4f8c9..fa0093132c 100644 --- a/library/compiler/templates.factor +++ b/library/compiler/templates.factor @@ -90,7 +90,7 @@ SYMBOL: phantom-r : lazy-load ( value loc -- value ) over ds-loc? pick cs-loc? or [ dupd = [ - drop f + >r alloc-reg dup r> %peek , ! drop f ] [ >r alloc-reg dup r> %peek , ] if @@ -166,11 +166,8 @@ SYMBOL: any-reg >r phantom-d get template-match? r> and ; : split-template ( template phantom -- slow fast ) - over length over length <= [ - drop { } swap - ] [ - length swap cut* - ] if ; + over length over length <= + [ drop { } swap ] [ length swap cut* ] if ; : split-templates ( template template -- slow slow fast fast ) >r phantom-d get split-template r> diff --git a/library/test/compiler/templates.factor b/library/test/compiler/templates.factor index 5a1ddc5bbc..54862ae6eb 100644 --- a/library/test/compiler/templates.factor +++ b/library/test/compiler/templates.factor @@ -14,6 +14,10 @@ math-internals namespaces test ; [ 0 ] [ 3 [ tag ] compile-1 ] unit-test [ 0 3 ] [ 3 [ [ tag ] keep ] compile-1 ] unit-test +[ 2 3 ] [ 3 [ 2 swap ] compile-1 ] unit-test + +[ 2 3 4 ] [ 3 [ 2 swap 4 ] compile-1 ] unit-test + [ { 1 2 3 } { 1 4 3 } 8 8 ] [ { 1 2 3 } { 1 4 3 } [ over type over type ] compile-1 ] unit-test