[pypy-svn] r32791 - pypy/dist/pypy/rpython

arigo at codespeak.net arigo at codespeak.net
Sun Oct 1 17:09:03 CEST 2006


Author: arigo
Date: Sun Oct  1 17:09:01 2006
New Revision: 32791

Modified:
   pypy/dist/pypy/rpython/llinterp.py
Log:
Change the switch logic in llinterp to cope with switches where values
are llptrs (which explode if compared with the None object).


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Sun Oct  1 17:09:01 2006
@@ -328,16 +328,22 @@
                     raise e
         else:
             llexitvalue = self.getval(block.exitswitch)
-            for link in block.exits:
+            if block.exits[-1].exitcase == "default":
+                defaultexit = block.exits[-1]
+                nondefaultexits = block.exits[:-1]
+                assert defaultexit.llexitcase is None
+            else:
+                defaultexit = None
+                nondefaultexits = block.exits
+            for link in nondefaultexits:
                 if link.llexitcase == llexitvalue:
                     break   # found -- the result is in 'link'
             else:
-                if block.exits[-1].exitcase == "default":
-                    assert block.exits[-1].llexitcase is None
-                    link = block.exits[-1]
-                else:
+                if defaultexit is None:
                     raise ValueError("exit case %r not found in the exit links "
                                      "of %r" % (llexitvalue, block))
+                else:
+                    link = defaultexit
         return link.target, [self.getval(x) for x in link.args]
 
     def eval_operation(self, operation):



More information about the Pypy-commit mailing list