[pypy-svn] r70327 - in pypy/branch/virtual-forcing/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Tue Dec 29 10:24:17 CET 2009


Author: arigo
Date: Tue Dec 29 10:24:16 2009
New Revision: 70327

Modified:
   pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py
Log:
Fix the test.


Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/codewriter.py	Tue Dec 29 10:24:16 2009
@@ -1705,6 +1705,3 @@
     def __str__(self):
         return "using virtualizable array in illegal way in %r" % (
             self.args[0],)
-
-class ForcingVirtualRef(Exception):
-    pass

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_codewriter.py	Tue Dec 29 10:24:16 2009
@@ -2,7 +2,7 @@
 from pypy.rlib import jit
 from pypy.jit.metainterp import support, typesystem
 from pypy.jit.metainterp.policy import JitPolicy
-from pypy.jit.metainterp.codewriter import CodeWriter, ForcingVirtualRef
+from pypy.jit.metainterp.codewriter import CodeWriter
 from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
 from pypy.translator.translator import graphof
 from pypy.rpython.lltypesystem.rbuiltin import ll_instantiate
@@ -101,6 +101,8 @@
     def make_graphs(self, func, values, type_system='lltype'):
         class FakeMetaInterpSd:
             virtualizable_info = None
+            class options:
+                listops = True
             def find_opcode(self, name):
                 default = len(self.opname_to_index)
                 return self.opname_to_index.setdefault(name, default)
@@ -460,8 +462,11 @@
         cw = CodeWriter(self.rtyper)
         cw.candidate_graphs = [graphs[0]]
         cw._start(self.metainterp_sd, None)
-        py.test.raises(ForcingVirtualRef, cw.make_one_bytecode,
-                       (graphs[0], None), False)    # assert it does not work
+        jitcode = cw.make_one_bytecode((graphs[0], None), False)
+        assert 'virtual_ref' in jitcode._source
+        # the call vref() becomes a residual call to a helper that contains
+        # itself a copy of the call.
+        assert 'residual_call' in jitcode._source
 
 
 class ImmutableFieldsTests:



More information about the Pypy-commit mailing list