[pypy-svn] r66357 - in pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Sat Jul 18 15:44:17 CEST 2009


Author: arigo
Date: Sat Jul 18 15:44:16 2009
New Revision: 66357

Modified:
   pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimize.py
Log:
Add tests.  A small fix.


Modified: pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/optimize.py	Sat Jul 18 15:44:16 2009
@@ -193,6 +193,11 @@
                 return prebuiltNotSpecNode
         #
         assert exitnode.unique == UNIQUE_YES
+        if (inputnode.knownclsbox is not None and
+            not inputnode.knownclsbox.equals(exitnode.knownclsbox)):
+            # unique match, but the class is known to be a mismatch
+            return prebuiltNotSpecNode
+        #
         fields = []
         d = exitnode.curfields
         if d is not None:

Modified: pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimize.py	(original)
+++ pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimize.py	Sat Jul 18 15:44:16 2009
@@ -435,6 +435,28 @@
         # in p1 a Virtual and not in p2, as they both come from the same p3.
         self.find_nodes(ops, 'Not, Not')
 
+    def test_find_nodes_new_mismatch(self):
+        ops = """
+        [p1]
+        guard_class(p1, ConstClass(node_vtable))
+            fail()
+        p2 = new_with_vtable(ConstClass(node_vtable2), descr=nodesize2)
+        jump(p2)
+        """
+        self.find_nodes(ops, 'Not')
+
+    def test_find_nodes_new_aliasing_mismatch(self):
+        ops = """
+        [p0, p1]
+        guard_class(p0, ConstClass(node_vtable))
+            fail()
+        guard_class(p1, ConstClass(node_vtable2))
+            fail()
+        p2 = new_with_vtable(ConstClass(node_vtable2), descr=nodesize2)
+        jump(p2, p2)
+        """
+        self.find_nodes(ops, 'Not, Fixed(node_vtable2)')
+
 
 class TestLLtype(BaseTestOptimize, LLtypeMixin):
     pass



More information about the Pypy-commit mailing list