Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r51901:7cdc8cea91ab
Date: 2012-01-28 08:56 +0000
http://bitbucket.org/pypy/pypy/changeset/7cdc8cea91ab/

Log:    Fix: keep the original special-cases. Needed at least for
        ComputedIntSymbolics, otherwise they might force computation of
        their value, which is not what we want.

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,16 +78,18 @@
                 value = heaptracker.adr2int(value)
             if TYPE is lltype.SingleFloat:
                 value = longlong.singlefloat2int(value)
-            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
+            if not isinstance(value, (llmemory.AddressAsInt,
+                                      ComputedIntSymbolic)):
+                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
             constants = self.constants_i
         elif kind == 'ref':
             value = lltype.cast_opaque_ptr(llmemory.GCREF, value)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to