[pypy-svn] r52696 - in pypy/branch/jit-hotpath/pypy/jit: rainbow rainbow/test timeshifter

arigo at codespeak.net arigo at codespeak.net
Tue Mar 18 18:35:14 CET 2008


Author: arigo
Date: Tue Mar 18 18:35:13 2008
New Revision: 52696

Modified:
   pypy/branch/jit-hotpath/pypy/jit/rainbow/rhotpath.py
   pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py
   pypy/branch/jit-hotpath/pypy/jit/timeshifter/rtimeshift.py
Log:
Fix the store_back() of virtualizables in the code generated for
portal exits.


Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/rhotpath.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/rhotpath.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/rhotpath.py	Tue Mar 18 18:35:13 2008
@@ -23,15 +23,10 @@
     interp.frame.local_green = greenargs
     interp.graphsigtoken = graphsigtoken
 
-def leave_graph(interp, store_back_exception=True):
+def leave_graph(interp):
     jitstate = interp.jitstate
     exceptiondesc = interp.exceptiondesc
     builder = jitstate.curbuilder
-    #for virtualizable_box in jitstate.virtualizables:
-    #    assert isinstance(virtualizable_box, rvalue.PtrRedBox)
-    #    content = virtualizable_box.content
-    #    assert isinstance(content, rcontainer.VirtualizableStruct)
-    #    content.store_back(jitstate)        
     exceptiondesc.store_global_excdata(jitstate)
     jitstate.curbuilder.finish_and_return(interp.graphsigtoken, None)
     jitstate.curbuilder = None
@@ -66,6 +61,7 @@
 
 def hp_return(interp, gv_result):
     interp.debug_trace("done at hp_return")
+    interp.jitstate.store_back_virtualizables_at_return()
     # XXX slowish
     desc = interp.hotrunnerdesc
     exitfnptr = llhelper(desc.RAISE_DONE_FUNCPTR, desc.raise_done)
@@ -349,6 +345,9 @@
 
     jitstate.curbuilder = excpath_builder
     excpath_builder.start_writing()
+    # virtualizables: when we reach this point, the fallback interpreter
+    # should already have done the right thing, i.e. stored the values
+    # back into the structure (reading them out of framebase+frameinfo)
     leave_graph(fbp.hotrunnerdesc.interpreter)
 
 # for testing purposes

Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py	Tue Mar 18 18:35:13 2008
@@ -260,7 +260,6 @@
                 [lltype.Ptr(XY), lltype.Signed, lltype.Signed, lltype.Ptr(E)])
 
     def test_simple_return_it(self):
-        py.test.skip("in-progress")
         class MyJitDriver(JitDriver):
             greens = []
             reds = ['i', 'xy']
@@ -288,6 +287,8 @@
         assert res == main(20, 22)
         self.check_insns_in_loops(getfield=0, setfield=0)
 
+        # also run the test with a threshold of 1 to check if the return
+        # path (taken only once) is compiled correctly
         res = self.run(main, [20, 22], threshold=1)
         assert res == main(20, 22)
         self.check_insns_in_loops(getfield=0, setfield=0)

Modified: pypy/branch/jit-hotpath/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/timeshifter/rtimeshift.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/timeshifter/rtimeshift.py	Tue Mar 18 18:35:13 2008
@@ -1131,6 +1131,13 @@
                 content.store_back(self)
         return incoming
 
+    def store_back_virtualizables_at_return(self):
+        for virtualizable_box in self.virtualizables:
+            assert isinstance(virtualizable_box, rvalue.PtrRedBox)
+            content = virtualizable_box.content
+            assert isinstance(content, rcontainer.VirtualizableStruct)
+            content.store_back(self)
+
     def prepare_for_residual_call(self):
         virtualizables = self.virtualizables
         if virtualizables:



More information about the Pypy-commit mailing list