diff --git a/library/bootstrap/boot-stage1.factor b/library/bootstrap/boot-stage1.factor index 470f9bc800..ac7a6a6a01 100644 --- a/library/bootstrap/boot-stage1.factor +++ b/library/bootstrap/boot-stage1.factor @@ -113,6 +113,8 @@ sequences io vectors words ; "/library/bootstrap/image.factor" + "/library/compiler/architecture.factor" + "/library/inference/shuffle.factor" "/library/inference/dataflow.factor" "/library/inference/inference.factor" @@ -128,8 +130,7 @@ sequences io vectors words ; "/library/inference/stack.factor" "/library/inference/call-optimizers.factor" "/library/inference/print-dataflow.factor" - - "/library/compiler/architecture.factor" + "/library/compiler/assembler.factor" "/library/compiler/relocate.factor" "/library/compiler/xt.factor" diff --git a/library/inference/optimizer.factor b/library/inference/optimizer.factor index e90efc5ea9..92b150d812 100644 --- a/library/inference/optimizer.factor +++ b/library/inference/optimizer.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2004, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: inference -USING: generic hashtables inference kernel lists -matrices namespaces sequences vectors ; +USING: compiler-frontend generic hashtables inference kernel +lists math matrices namespaces sequences vectors ; ! We use the recursive-state variable here, to track nested ! label scopes, to prevent infinite loops when inlining @@ -55,10 +55,17 @@ M: #push optimize-node* ( node -- node/t ) [ node-out-d empty? ] prune-if ; ! #shuffle +: compose-shuffle-nodes ( #shuffle #shuffle -- #shuffle/t ) + [ >r node-shuffle r> node-shuffle compose-shuffle ] keep + over shuffle-in-d length pick shuffle-in-r length + vregs > [ + 2drop t + ] [ + [ set-node-shuffle ] keep + ] ifte ; + M: #shuffle optimize-node* ( node -- node/t ) dup node-successor dup #shuffle? [ - [ >r node-shuffle r> node-shuffle compose-shuffle ] keep - [ set-node-shuffle ] keep + compose-shuffle-nodes ] [ drop [ dup node-in-d empty? swap node-in-r empty? and