]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.tree.propagation: fix both-fixnums? trick
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 2 May 2010 20:22:08 +0000 (16:22 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 3 May 2010 21:34:30 +0000 (17:34 -0400)
basis/compiler/tree/propagation/known-words/known-words.factor
basis/compiler/tree/propagation/transforms/transforms.factor

index 351da4e2f804181e1379ad7704c5a8bced9d42e4..7fb36c96fd76d9bdb732403d05605d7a12661500 100644 (file)
@@ -220,16 +220,6 @@ generic-comparison-ops [
     2bi and maybe-or-never
 ] "outputs" set-word-prop
 
-\ both-fixnums? [
-    node-input-infos first2 [ class>> ] bi@ {
-        { [ 2dup [ fixnum classes-intersect? not ] either? ] [ [ 2drop f ] ] }
-        { [ 2dup [ fixnum class<= ] both? ] [ [ 2drop t ] ] }
-        { [ dup fixnum class<= ] [ [ drop fixnum? ] ] }
-        { [ over fixnum class<= ] [ [ nip fixnum? ] ] }
-        [ f ]
-    } cond 2nip
-] "custom-inlining" set-word-prop
-
 {
     { >fixnum fixnum }
     { bignum>fixnum fixnum }
index f8d43e37c414dc4038b66e585522873cb224b540..3d2d7ac298c17d42ed59abac16b300aec34b15c7 100644 (file)
@@ -313,3 +313,14 @@ M\ set intersect [ intersect-quot ] 1 define-partial-eval
         [ depends-on-definition ] [ heap-size '[ _ ] ] bi
     ] [ drop f ] if
 ] 1 define-partial-eval
+
+! Eliminates a few redundant checks here and there
+\ both-fixnums? [
+    in-d>> first2 [ value-info class>> ] bi@ {
+        { [ 2dup [ fixnum classes-intersect? not ] either? ] [ [ 2drop f ] ] }
+        { [ 2dup [ fixnum class<= ] both? ] [ [ 2drop t ] ] }
+        { [ dup fixnum class<= ] [ [ drop fixnum? ] ] }
+        { [ over fixnum class<= ] [ [ nip fixnum? ] ] }
+        [ f ]
+    } cond 2nip
+] "custom-inlining" set-word-prop