[pypy-commit] pypy default: Tweak to ignore all Symbolics, not just some of them,

arigo noreply at buildbot.pypy.org
Sat Jan 28 10:26:21 CET 2012


Author: Armin Rigo <arigo at tunes.org>
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


More information about the pypy-commit mailing list