]> gitweb.factorcode.org Git - factor.git/commitdiff
Fixing optimization for improved method inlining
authorDaniel Ehrenberg <littledan@pool-224-36.res.carleton.edu>
Mon, 19 Apr 2010 21:37:35 +0000 (16:37 -0500)
committerDaniel Ehrenberg <littledan@pool-224-36.res.carleton.edu>
Tue, 4 May 2010 21:46:07 +0000 (16:46 -0500)
basis/compiler/tree/propagation/inlining/inlining.factor
basis/compiler/tree/propagation/propagation-tests.factor

index ad3de5d8f72b311cfff230e18f2b262a1bbdbca6..07ff719d0947a796d952bbc7ae13e6a57fd211d9 100644 (file)
@@ -55,18 +55,23 @@ M: callable splicing-nodes splicing-body ;
         [ generic no-method ] if
     ] and ;
 
+: class-min ( class1 class2 -- class/f ? )
+    2dup class<= [ drop t ] [
+        2dup swap class<=
+        [ nip t ] [ 2drop f f ] if
+    ] if ;
+
 :: split-method-call ( class generic -- quot/f )
     class object = [ f ] [
         object generic method-classes 
         [| last-class new-class |
             class new-class classes-intersect? [
                 new-class class class<= [
-                    last-class new-class class<=
-                    last-class new-class ? f
-                ] [ object t ] if
-            ] [ last-class f ] if
-        ] any?
-        [ drop f ] [ generic split-code ] if
+                    last-class new-class class-min
+                ] [ object f ] if
+            ] [ last-class t ] if
+        ] all?
+        [ generic split-code ] [ drop f ] if
     ] if ;
 
 : inlining-standard-method ( #call word -- class/f method/f )
index 8c470bf6a28f3986adbc12635ececeb8988a2409..4fc623b7dc0d7830f6d0d6966c2fdd813f98deb1 100644 (file)
@@ -693,7 +693,7 @@ M: fixnum bad-generic 1 fixnum+fast ; inline
 
 [ V{ fixnum } ] [ [ bad-behavior ] final-classes ] unit-test
 
-[ V{ number } ] [
+[ V{ integer } ] [
     [
         0 10 [ bad-generic dup 123 bitand drop bad-generic 1 + ] times
     ] final-classes
@@ -994,3 +994,6 @@ UNION: ?fixnum fixnum POSTPONE: f ;
 [ t ] [ 1 instance-test-2 ] unit-test
 [ f ] [ 1.1 instance-test-2 ] unit-test
 [ t ] [ f instance-test-3 ] unit-test
+
+[ t ] [ [ { ?fixnum } declare >fixnum ] { >fixnum } inlined? ] unit-test
+[ f ] [ [ { integer } declare >fixnum ] { >fixnum } inlined? ] unit-test