]> gitweb.factorcode.org Git - factor.git/commitdiff
inlining type_of; speeds up mandelbrot by a nice factor
authorSlava Pestov <slava@factorcode.org>
Sun, 19 Dec 2004 01:32:32 +0000 (01:32 +0000)
committerSlava Pestov <slava@factorcode.org>
Sun, 19 Dec 2004 01:32:32 +0000 (01:32 +0000)
TODO.FACTOR.txt
native/types.c
native/types.h

index 5a58ac42cc209cd365c2b5a513040b0097ffd808..be259c95060607f5e202b07ef5bfa4d76089b2e2 100644 (file)
@@ -14,7 +14,6 @@
 + linearizer/generator:\r
 \r
 - getenv/setenv: if literal arg, compile as a load/store\r
-- compiler: drop literal peephole optimization\r
 \r
 + compiler frontend:\r
 \r
index d5bd376d55ef7de2b3a7c8f5f9b1f6fcf5d32e39..dbe2fd330493989a0d3858fcb4350af16536254a 100644 (file)
@@ -1,19 +1,5 @@
 #include "factor.h"
 
-CELL type_of(CELL tagged)
-{
-       CELL tag = TAG(tagged);
-       if(tag == OBJECT_TYPE)
-       {
-               if(tagged == F)
-                       return F_TYPE;
-               else
-                       return untag_header(get(UNTAG(tagged)));
-       }
-       else
-               return tag;
-}
-
 bool typep(CELL type, CELL tagged)
 {
        return type_of(tagged) == type;
index 3d02a45543ff2fddd8919b04f02a8f6c32a20f19..7bc6ab6288a5fc1951864ef0d008f3a70f671446 100644 (file)
@@ -43,7 +43,8 @@ CELL T;
 #define NUMBER_TYPE 103 /* F_COMPLEX or REAL */
 #define TEXT_TYPE 104 /* F_FIXNUM or F_STRING */
 
-CELL type_of(CELL tagged);
+/* CELL type_of(CELL tagged); */
+
 bool typep(CELL type, CELL tagged);
 
 INLINE CELL tag_header(CELL cell)
@@ -105,3 +106,17 @@ CELL untagged_object_size(CELL pointer);
 CELL object_size(CELL pointer);
 void primitive_type(void);
 void primitive_size(void);
+
+INLINE CELL type_of(CELL tagged)
+{
+       CELL tag = TAG(tagged);
+       if(tag == OBJECT_TYPE)
+       {
+               if(tagged == F)
+                       return F_TYPE;
+               else
+                       return untag_header(get(UNTAG(tagged)));
+       }
+       else
+               return tag;
+}