]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tree/propagation/transforms/transforms.factor
Merge branch 'master' into propagation
[factor.git] / basis / compiler / tree / propagation / transforms / transforms.factor
index 28de7abd4bfc93fc0d84f91f266b02732a707444..947f481cef60021a85affd4bbdaf3e199e4523f9 100644 (file)
@@ -142,6 +142,23 @@ IN: compiler.tree.propagation.transforms
     } case
 ] "custom-inlining" set-word-prop
 
+:: inline-instance ( node -- quot/f )
+    node in-d>> first2 [ value-info ] bi@ literal>> :> ( obj class )
+    class class? [
+        {
+            [ class \ f = not ]
+            [ obj class>> \ f class-not class-and class class<= ]
+        } 0&& [
+            ! TODO: replace this with an implicit null check when
+            ! profitable, once Factor gets OSR implemented
+            [ drop >boolean ]
+        ] [
+            class "predicate" word-prop '[ drop @ ]
+        ] if
+    ] [ f ] if ;
+
+\ instance? [ inline-instance ] "custom-inlining" set-word-prop
+
 ERROR: bad-partial-eval quot word ;
 
 : check-effect ( quot word -- )
@@ -174,11 +191,6 @@ ERROR: bad-partial-eval quot word ;
 
 \ new [ inline-new ] 1 define-partial-eval
 
-\ instance? [
-    dup class?
-    [ "predicate" word-prop ] [ drop f ] if
-] 1 define-partial-eval
-
 ! Shuffling
 : nths-quot ( indices -- quot )
     [ [ '[ _ swap nth ] ] map ] [ length ] bi
@@ -301,12 +313,6 @@ M\ set intersect [ intersect-quot ] 1 define-partial-eval
     [ \ push def>> ] [ f ] if
 ] "custom-inlining" set-word-prop
 
-! Speeds up fasta benchmark
-\ >fixnum [
-    in-d>> first value-info class>> fixnum \ f class-or class<=
-    [ [ dup [ \ >fixnum no-method ] unless ] ] [ f ] if
-] "custom-inlining" set-word-prop
-
 ! We want to constant-fold calls to heap-size, and recompile those
 ! calls when a C type is redefined
 \ heap-size [