From: Taylor R Campbell Date: Tue, 31 Aug 2010 15:25:00 +0000 (+0000) Subject: Exploit OBJECT->FIXNUM's independence of tag on i386 and x86-64. X-Git-Tag: 20101212-Gtk~73^2~2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=0d9c973763877502f815fc5723f203fe06441da7;p=mit-scheme.git Exploit OBJECT->FIXNUM's independence of tag on i386 and x86-64. --- diff --git a/src/compiler/machines/i386/rulrew.scm b/src/compiler/machines/i386/rulrew.scm index 40276c26a..1b2dc8d23 100644 --- a/src/compiler/machines/i386/rulrew.scm +++ b/src/compiler/machines/i386/rulrew.scm @@ -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)) diff --git a/src/compiler/machines/x86-64/rulrew.scm b/src/compiler/machines/x86-64/rulrew.scm index 8cec290c0..bbe0973ab 100644 --- a/src/compiler/machines/x86-64/rulrew.scm +++ b/src/compiler/machines/x86-64/rulrew.scm @@ -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))