From 10b75276ffca8cdac473b73ac050162227daff29 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 15 Aug 2008 02:49:52 -0500 Subject: [PATCH] Fix optimization of clone, (clone) --- .../compiler/tree/propagation/known-words/known-words.factor | 5 ++++- basis/compiler/tree/propagation/propagation-tests.factor | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/compiler/tree/propagation/known-words/known-words.factor b/basis/compiler/tree/propagation/known-words/known-words.factor index 4ab7fcea4e..bc6f00dfa8 100644 --- a/basis/compiler/tree/propagation/known-words/known-words.factor +++ b/basis/compiler/tree/propagation/known-words/known-words.factor @@ -263,7 +263,10 @@ generic-comparison-ops [ ] +outputs+ set-word-prop ! the output of clone has the same type as the input -{ clone (clone) } [ [ ] +outputs+ set-word-prop ] each +{ clone (clone) } [ + [ clone f >>literal f >>literal? ] + +outputs+ set-word-prop +] each \ slot [ dup literal?>> diff --git a/basis/compiler/tree/propagation/propagation-tests.factor b/basis/compiler/tree/propagation/propagation-tests.factor index 7d7959164d..53b90d3e98 100644 --- a/basis/compiler/tree/propagation/propagation-tests.factor +++ b/basis/compiler/tree/propagation/propagation-tests.factor @@ -566,3 +566,5 @@ M: integer infinite-loop infinite-loop ; [ V{ tuple } ] [ [ tuple-layout ] final-classes ] unit-test [ ] [ [ instance? ] final-classes drop ] unit-test + +[ f ] [ [ V{ } clone ] final-info first literal?>> ] unit-test