Exploit OBJECT->FIXNUM's independence of tag on i386 and x86-64.
authorTaylor R Campbell <campbell@mumble.net>
Tue, 31 Aug 2010 15:25:00 +0000 (15:25 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Tue, 31 Aug 2010 15:25:00 +0000 (15:25 +0000)
src/compiler/machines/i386/rulrew.scm
src/compiler/machines/x86-64/rulrew.scm

index 40276c26aad6b02cc1d47f772db60c1d0c4a9a2b..1b2dc8d232e39920d45912544462ba2aaef7e2b2 100644 (file)
@@ -150,6 +150,16 @@ USA.
   (QUALIFIER (rtl:constant-fixnum? source))
   (rtl:make-object->fixnum source))
 
+(define-rule rewriting
+  (OBJECT->FIXNUM (REGISTER (? source register-known-value)))
+  (QUALIFIER (rtl:cons-non-pointer? source))
+  (rtl:make-object->fixnum (rtl:cons-non-pointer-datum source)))
+
+(define-rule rewriting
+  (OBJECT->FIXNUM (REGISTER (? source register-known-value)))
+  (QUALIFIER (rtl:object->datum? source))
+  (rtl:make-object->fixnum (rtl:object->datum-expression source)))
+
 (define-rule rewriting
   (FIXNUM-2-ARGS MULTIPLY-FIXNUM
                 (REGISTER (? operand-1 register-known-value))
index 8cec290c098e7a80758e122c7c42862dee1f65e9..bbe0973ab30737959084d43ee8028477a67fc17a 100644 (file)
@@ -150,6 +150,16 @@ USA.
   (QUALIFIER (rtl:constant-fixnum? source))
   (rtl:make-object->fixnum source))
 
+(define-rule rewriting
+  (OBJECT->FIXNUM (REGISTER (? source register-known-value)))
+  (QUALIFIER (rtl:cons-non-pointer? source))
+  (rtl:make-object->fixnum (rtl:cons-non-pointer-datum source)))
+
+(define-rule rewriting
+  (OBJECT->FIXNUM (REGISTER (? source register-known-value)))
+  (QUALIFIER (rtl:object->datum? source))
+  (rtl:make-object->fixnum (rtl:object->datum-expression source)))
+
 (define-rule rewriting
   (FIXNUM-2-ARGS MULTIPLY-FIXNUM
                 (REGISTER (? operand-1 register-known-value))