[pypy-svn] r67216 - pypy/branch/pyjitpl5/pypy/translator/backendopt

antocuni at codespeak.net antocuni at codespeak.net
Wed Aug 26 16:38:03 CEST 2009


Author: antocuni
Date: Wed Aug 26 16:38:01 2009
New Revision: 67216

Modified:
   pypy/branch/pyjitpl5/pypy/translator/backendopt/inline.py
Log:
in rare cases, it might happend that we want to downcast instead of upcasting. Unfortunately, I spent 1 day searching for a failing test without success :-/


Modified: pypy/branch/pyjitpl5/pypy/translator/backendopt/inline.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/translator/backendopt/inline.py	(original)
+++ pypy/branch/pyjitpl5/pypy/translator/backendopt/inline.py	Wed Aug 26 16:38:01 2009
@@ -485,10 +485,14 @@
             INPUT_SELF = inputv.concretetype
             if LINK_SELF != INPUT_SELF:
                 # need to insert an upcast
-                assert ootype.isSubclass(LINK_SELF, INPUT_SELF)
+                if ootype.isSubclass(LINK_SELF, INPUT_SELF):
+                    opname = 'ooupcast'
+                else:
+                    assert ootype.isSubclass(INPUT_SELF, LINK_SELF)
+                    opname = 'oodowncast'
                 v = Variable()
                 v.concretetype = INPUT_SELF
-                upcast = SpaceOperation('ooupcast', [linkv], v)
+                upcast = SpaceOperation(opname, [linkv], v)
                 block.operations.append(upcast)
                 passon_args[0] = v
 



More information about the Pypy-commit mailing list