[pypy-svn] r69863 - in pypy/trunk/pypy/rpython: lltypesystem test

arigo at codespeak.net arigo at codespeak.net
Thu Dec 3 12:37:49 CET 2009


Author: arigo
Date: Thu Dec  3 12:37:48 2009
New Revision: 69863

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/rclass.py
   pypy/trunk/pypy/rpython/test/test_rvirtualizable2.py
Log:
Test and fix.  Bah.


Modified: pypy/trunk/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rclass.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rclass.py	Thu Dec  3 12:37:48 2009
@@ -499,7 +499,7 @@
                     cvalue = inputconst(r.lowleveltype,
                                         r.convert_desc_or_const(value))
                     self.setfield(vptr, fldname, cvalue, llops,
-                                  {'access_directly': True})
+                                  flags={'access_directly': True})
         return vptr
 
     def rtype_type(self, hop):

Modified: pypy/trunk/pypy/rpython/test/test_rvirtualizable2.py
==============================================================================
--- pypy/trunk/pypy/rpython/test/test_rvirtualizable2.py	(original)
+++ pypy/trunk/pypy/rpython/test/test_rvirtualizable2.py	Thu Dec  3 12:37:48 2009
@@ -4,10 +4,14 @@
 from pypy.rpython.rvirtualizable2 import replace_promote_virtualizable_with_call
 from pypy.rlib.jit import hint
 from pypy.objspace.flow.model import summary
+from pypy.rpython.llinterp import LLInterpreter
+from pypy import conftest
 
 
 class V(object):
     _virtualizable2_ = ['v']
+    v = -12
+    w = -62
 
     def __init__(self, v):
         self.v = v
@@ -137,7 +141,8 @@
                 break
             
         def mycall(vinst_ll):
-            pass
+            if vinst_ll.vable_token:
+                raise ValueError
         annhelper = MixLevelHelperAnnotator(rtyper)
         if self.type_system == 'lltype':
             s_vinst = annmodel.SomePtr(v_inst_ll_type)
@@ -158,12 +163,18 @@
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         funcptr = self.replace_promote_virtualizable(rtyper, [graph])
+        if getattr(conftest.option, 'view', False):
+            graph.show()
         op_promote = block.operations[-2]
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         assert op_promote.opname == 'direct_call'
         assert op_promote.args[0].value == funcptr
         assert op_promote.args[1] == op_getfield.args[0]
+        #
+        interp = LLInterpreter(rtyper)
+        res = interp.eval_graph(graph, [61])
+        assert res == 61
 
     def test_access_directly(self):
         def g(b):



More information about the Pypy-commit mailing list