[pypy-svn] r12796 - in pypy/dist/pypy: objspace/flow rpython rpython/test

arigo at codespeak.net arigo at codespeak.net
Wed May 25 20:01:39 CEST 2005


Author: arigo
Date: Wed May 25 20:01:39 2005
New Revision: 12796

Modified:
   pypy/dist/pypy/objspace/flow/model.py
   pypy/dist/pypy/rpython/rtyper.py
   pypy/dist/pypy/rpython/test/test_rlist.py
Log:
- Very minimal checking of the flow graphs produced by the RTyper.
- Fixed a bug discovered by this.


Modified: pypy/dist/pypy/objspace/flow/model.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/model.py	(original)
+++ pypy/dist/pypy/objspace/flow/model.py	Wed May 25 20:01:39 2005
@@ -367,7 +367,7 @@
                         if isinstance(v, Variable):
                             assert v in vars
                         else:
-                            assert v.value != last_exception
+                            assert v.value is not last_exception
                             #assert v.value != last_exc_value
                 exc_links = {}
                 if block.exitswitch is None:
@@ -402,7 +402,7 @@
                                 assert v != block.operations[-1].result
                         else:
                             if not exc_link:
-                                assert v.value != last_exception
+                                assert v.value is not last_exception
                                 #assert v.value != last_exc_value
                 vars_previous_blocks.update(vars)
 

Modified: pypy/dist/pypy/rpython/rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/rtyper.py	(original)
+++ pypy/dist/pypy/rpython/rtyper.py	Wed May 25 20:01:39 2005
@@ -146,7 +146,6 @@
             # for simplicity of the consider_meth, resultvar is usually not
             # op.result here.  We have to replace resultvar with op.result
             # in all generated operations.
-            varmapping[resultvar] = op.result
             resulttype = resultvar.concretetype
             op.result.concretetype = s_expected.lowleveltype()
             if op.result.concretetype != resulttype:
@@ -155,6 +154,9 @@
                                  "   rtyper says %r" % (op.opname,
                                                         op.result.concretetype,
                                                         resulttype))
+            while resultvar in varmapping:
+                resultvar = varmapping[resultvar]
+            varmapping[resultvar] = op.result
         else:
             # consider_meth() can actually generate no operation and return
             # a Constant.

Modified: pypy/dist/pypy/rpython/test/test_rlist.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rlist.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rlist.py	Wed May 25 20:01:39 2005
@@ -13,7 +13,7 @@
     typer = RPythonTyper(t.annotator)
     typer.specialize()
     #t.view()
-    assert "did not crash"
+    t.checkgraphs()
 
 
 def test_append():
@@ -28,4 +28,4 @@
     typer = RPythonTyper(t.annotator)
     typer.specialize()
     #t.view()
-    assert "did not crash"
+    t.checkgraphs()



More information about the Pypy-commit mailing list