[pypy-svn] r61807 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test

arigo at codespeak.net arigo at codespeak.net
Thu Feb 12 18:46:44 CET 2009


Author: arigo
Date: Thu Feb 12 18:46:44 2009
New Revision: 61807

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
Log:
A new test (that passes).


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_vable_optimize.py	Thu Feb 12 18:46:44 2009
@@ -154,3 +154,39 @@
     assert len(spec.specnodes[0].fields) == 1
     assert spec.specnodes[0].fields[0][0] == B.ofs_node
     assert spec.specnodes[0].fields[0][1] is None
+
+# ____________________________________________________________
+
+class C:
+    locals().update(B.__dict__)
+    n2 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, frame.node))
+    v2 = BoxInt(13)
+    ops = [
+        MergePoint('merge_point', [fr], []),
+        ResOperation('guard_nonvirtualized', [fr, ConstAddr(xy_vtable, cpu),
+                                              ConstInt(ofs_node)], []),
+        #
+        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], [n1]),
+        ResOperation('guard_class', [n1, ConstAddr(node_vtable, cpu)], []),
+        ResOperation('getfield_gc', [n1, ConstInt(ofs_value)], [v]),
+        #
+        ResOperation('getfield_gc', [fr, ConstInt(ofs_node)], [n2]),
+        ResOperation('guard_class', [n2, ConstAddr(node_vtable, cpu)], []),
+        ResOperation('getfield_gc', [n2, ConstInt(ofs_value)], [v2]),
+        #
+        Jump('jump', [fr], []),
+        ]
+    ops[1].vdesc = xy_desc
+
+def test_C_intersect_input_and_output():
+    spec = PerfectSpecializer(C.ops)
+    spec.find_nodes()
+    spec.intersect_input_and_output()
+    assert spec.nodes[C.fr].escaped
+    assert spec.nodes[C.fr].virtualized
+    assert not spec.nodes[C.n1].escaped
+    assert not spec.nodes[C.n2].escaped
+    assert isinstance(spec.specnodes[0], VirtualizableSpecNode)
+    assert len(spec.specnodes[0].fields) == 1
+    assert spec.specnodes[0].fields[0][0] == C.ofs_node
+    assert spec.specnodes[0].fields[0][1] is None



More information about the Pypy-commit mailing list