Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r51900:15600a1bc7ca
Date: 2012-01-28 09:21 +0100
http://bitbucket.org/pypy/pypy/changeset/15600a1bc7ca/

Log:    Tweak to ignore all Symbolics, not just some of them, by ignoring
        the TypeError when trying to compare them with small numbers.

diff --git a/pypy/jit/codewriter/assembler.py b/pypy/jit/codewriter/assembler.py
--- a/pypy/jit/codewriter/assembler.py
+++ b/pypy/jit/codewriter/assembler.py
@@ -78,10 +78,13 @@
                 value = heaptracker.adr2int(value)
             if TYPE is lltype.SingleFloat:
                 value = longlong.singlefloat2int(value)
-            if not isinstance(value, (llmemory.AddressAsInt,
-                                      ComputedIntSymbolic)):
-                value = lltype.cast_primitive(lltype.Signed, value)
-                if allow_short and -128 <= value <= 127:
+            value = lltype.cast_primitive(lltype.Signed, value)
+            if allow_short:
+                try:
+                    short_num = -128 <= value <= 127
+                except TypeError:    # "Symbolics cannot be compared!"
+                    short_num = False
+                if short_num:
                     # emit the constant as a small integer
                     self.code.append(chr(value & 0xFF))
                     return True
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to