Author: Carl Friedrich Bolz <[email protected]>
Branch: 
Changeset: r61232:aabdafe82886
Date: 2013-02-14 15:42 +0100
http://bitbucket.org/pypy/pypy/changeset/aabdafe82886/

Log:    Add an assertion that the number of constants in a function is only
        up to 256. I just ran into the problem and the behaviour is very
        confusing.

diff --git a/rpython/jit/codewriter/assembler.py 
b/rpython/jit/codewriter/assembler.py
--- a/rpython/jit/codewriter/assembler.py
+++ b/rpython/jit/codewriter/assembler.py
@@ -107,7 +107,9 @@
         key = (kind, Constant(value))
         if key not in self.constants_dict:
             constants.append(value)
-            self.constants_dict[key] = 256 - len(constants)
+            val = 256 - len(constants)
+            assert val >= 0, "too many constants"
+            self.constants_dict[key] = val
         # emit the constant normally, as one byte that is an index in the
         # list of constants
         self.code.append(chr(self.constants_dict[key]))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to