[pypy-svn] r68246 - pypy/trunk/pypy/jit/metainterp

antocuni at codespeak.net antocuni at codespeak.net
Thu Oct 8 15:46:27 CEST 2009


Author: antocuni
Date: Thu Oct  8 15:46:26 2009
New Revision: 68246

Modified:
   pypy/trunk/pypy/jit/metainterp/resume.py
Log:
don't store null keys into the dictionary, as it doesn't work on cli


Modified: pypy/trunk/pypy/jit/metainterp/resume.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/resume.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/resume.py	Thu Oct  8 15:46:26 2009
@@ -99,6 +99,20 @@
         self.consts = []
         self.large_ints = {}
         self.refs = {}
+        self.nullref = UNASSIGNED
+
+    # we cannot store null keys into dictionaries when translating to CLI, so
+    # we special case them
+    def getref(self, key):
+        if not key:
+            return self.nullref
+        return self.refs.get(key, UNASSIGNED)
+
+    def setref(self, val, tagged):
+        if not val:
+            self.nullref = tagged
+        else:
+            self.refs[val] = tagged
 
     def getconst(self, const):
         if const.type == INT:
@@ -119,11 +133,11 @@
         elif const.type == REF:
             val = const.getref_base()
             val = self.cpu.ts.cast_ref_to_hashable(self.cpu, val)
-            tagged = self.refs.get(val, UNASSIGNED)
+            tagged = self.getref(val)
             if not tagged_eq(tagged, UNASSIGNED):
                 return tagged
             tagged = self._newconst(const)
-            self.refs[val] = tagged
+            self.setref(val, tagged)
             return tagged            
         return self._newconst(const)
 



More information about the Pypy-commit mailing list