[pypy-svn] r58060 - in pypy/branch/oo-jit/pypy/rpython: . lltypesystem ootypesystem test

antocuni at codespeak.net antocuni at codespeak.net
Thu Sep 11 11:42:54 CEST 2008


Author: antocuni
Date: Thu Sep 11 11:42:53 2008
New Revision: 58060

Modified:
   pypy/branch/oo-jit/pypy/rpython/lltypesystem/rdict.py
   pypy/branch/oo-jit/pypy/rpython/ootypesystem/rdict.py
   pypy/branch/oo-jit/pypy/rpython/rpbc.py
   pypy/branch/oo-jit/pypy/rpython/test/test_rpbc.py
Log:
r57808 caused a lot of tests to fail. Revert it, and put a workaround directly
in the rdict code



Modified: pypy/branch/oo-jit/pypy/rpython/lltypesystem/rdict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/lltypesystem/rdict.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/lltypesystem/rdict.py	Thu Sep 11 11:42:53 2008
@@ -194,6 +194,11 @@
 
 
     def convert_const(self, dictobj):
+        def convert_value_if_not_Void(repr, value):
+            if repr.lowleveltype is lltype.Void:
+                return None
+            return repr.convert_const(value)
+        
         # get object from bound dict methods
         #dictobj = getattr(dictobj, '__self__', dictobj) 
         if dictobj is None:
@@ -219,7 +224,7 @@
 
                 for dictkeycontainer, dictvalue in dictobj._dict.items():
                     llkey = r_key.convert_const(dictkeycontainer.key)
-                    llvalue = r_value.convert_const(dictvalue)
+                    llvalue = convert_value_if_not_Void(r_value, dictvalue)
                     ll_dict_insertclean(l_dict, llkey, llvalue,
                                         dictkeycontainer.hash)
                 return l_dict
@@ -227,7 +232,7 @@
             else:
                 for dictkey, dictvalue in dictobj.items():
                     llkey = r_key.convert_const(dictkey)
-                    llvalue = r_value.convert_const(dictvalue)
+                    llvalue = convert_value_if_not_Void(r_value, dictvalue)
                     ll_dict_insertclean(l_dict, llkey, llvalue,
                                         l_dict.keyhash(llkey))
                 return l_dict

Modified: pypy/branch/oo-jit/pypy/rpython/ootypesystem/rdict.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/ootypesystem/rdict.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/ootypesystem/rdict.py	Thu Sep 11 11:42:53 2008
@@ -166,6 +166,11 @@
         
 
     def convert_const(self, dictobj):
+        def convert_value_if_not_Void(repr, value):
+            if repr.lowleveltype is ootype.Void:
+                return None
+            return repr.convert_const(value)
+
         if dictobj is None:
             return self.DICT._defl()
         if not isinstance(dictobj, dict) and not isinstance(dictobj, objectmodel.r_dict):
@@ -191,14 +196,14 @@
             if self.custom_eq_hash:
                 for dictkeycont, dictvalue in dictobj._dict.items():
                     llkey = r_key.convert_const(dictkeycont.key)
-                    llvalue = r_value.convert_const(dictvalue)
+                    llvalue = convert_value_if_not_Void(r_value, dictvalue)
                     llhash = dictkeycont.hash
                     l_dictkeycont = objectmodel._r_dictkey_with_hash(l_dict._dict, llkey, llhash)
                     l_dict._dict._dict[l_dictkeycont] = llvalue
             else:
                 for dictkey, dictvalue in dictobj.items():
                     llkey = r_key.convert_const(dictkey)
-                    llvalue = r_value.convert_const(dictvalue)
+                    llvalue = convert_value_if_not_Void(r_value, dictvalue)
                     l_dict.ll_set(llkey, llvalue)
             return l_dict
 

Modified: pypy/branch/oo-jit/pypy/rpython/rpbc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/rpbc.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/rpbc.py	Thu Sep 11 11:42:53 2008
@@ -403,9 +403,6 @@
             raise TyperError("getattr on a constant PBC returns a non-constant")
         return hop.inputconst(hop.r_result, hop.s_result.const)
 
-    def convert_const(self, value):
-        return None
-
     def convert_desc(self, frozendesc):
         assert frozendesc is self.frozendesc
         return object()  # lowleveltype is Void

Modified: pypy/branch/oo-jit/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/test/test_rpbc.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/test/test_rpbc.py	Thu Sep 11 11:42:53 2008
@@ -1594,16 +1594,6 @@
 
         self.interpret(f, [int])
 
-    def test_specialize_singlefrozenpbc(self):
-        py.test.skip("r57808 makes this test fail, and llgraph tests rely on this")
-        from pypy.rlib.objectmodel import specialize
-        @specialize.arg(0)
-        def revealconst(T, x):
-            return lltype.cast_primitive(T, value)
-        def fn(x):
-            return revealconst(lltype.Signed, x)
-        res = self.interpret(fn, [42], backendopt=False)
-        assert res == 42
 
 class TestLLtype(BaseTestRPBC, LLRtypeMixin):
     pass



More information about the Pypy-commit mailing list