[pypy-svn] r23036 - pypy/dist/pypy/jit

arigo at codespeak.net arigo at codespeak.net
Sun Feb 5 14:21:28 CET 2006


Author: arigo
Date: Sun Feb  5 14:21:26 2006
New Revision: 23036

Modified:
   pypy/dist/pypy/jit/hintbookkeeper.py
   pypy/dist/pypy/jit/hintmodel.py
Log:
Specialization can trigger the assert contains() if care is not taken.


Modified: pypy/dist/pypy/jit/hintbookkeeper.py
==============================================================================
--- pypy/dist/pypy/jit/hintbookkeeper.py	(original)
+++ pypy/dist/pypy/jit/hintbookkeeper.py	Sun Feb  5 14:21:26 2006
@@ -1,5 +1,6 @@
 from pypy.tool.tls import tlsobject
 from pypy.objspace.flow.model import copygraph
+from pypy.annotation import model as annmodel
 
 TLS = tlsobject()
 
@@ -93,6 +94,14 @@
         op = block.operations[i]
         return op.result.concretetype
 
+    def current_op_binding(self):
+        _, block, i = self.position_key
+        op = block.operations[i]
+        hs_res = self.annotator.binding(op.result, extquery=True)
+        if hs_res is None:
+            hs_res = annmodel.s_ImpossibleValue
+        return hs_res
+
     def getvirtualcontainerdef(self, TYPE, constructor=None):
         try:
             res = self.virtual_containers[self.position_key]

Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py	(original)
+++ pypy/dist/pypy/jit/hintmodel.py	Sun Feb  5 14:21:26 2006
@@ -231,7 +231,11 @@
             if key == 'fixed':
                 deps_hs.append(hs_res)
             hs_res = reorigin(hs_res, *deps_hs)
-        return hs_res
+
+        # we need to make sure that hs_res does not become temporarily less
+        # general as a result of calling another specialized version of the
+        # function
+        return annmodel.unionof(hs_res, bookkeeper.current_op_binding())
 
     def getfield(hs_c1, hs_fieldname):
         S = hs_c1.concretetype.TO



More information about the Pypy-commit mailing list