[pypy-svn] r31448 - pypy/dist/pypy/jit/timeshifter

arigo at codespeak.net arigo at codespeak.net
Mon Aug 21 17:54:31 CEST 2006


Author: arigo
Date: Mon Aug 21 17:54:29 2006
New Revision: 31448

Modified:
   pypy/dist/pypy/jit/timeshifter/rtimeshift.py
   pypy/dist/pypy/jit/timeshifter/rtyper.py
Log:
(pedronis, arre, arigo)

Fix & refactor our preliminary direct_call support.


Modified: pypy/dist/pypy/jit/timeshifter/rtimeshift.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rtimeshift.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/rtimeshift.py	Mon Aug 21 17:54:29 2006
@@ -273,6 +273,14 @@
 def ll_gvar_from_constant(ll_value):
     return rgenop.genconst(ll_value)
 
+def before_call(jitstate):
+    leave_block(jitstate)
+    return jitstate.curbuilder
+
+def after_call(jitstate, newbuilder):
+    jitstate.curbuilder = newbuilder
+    return newbuilder.valuebox
+
 # ____________________________________________________________
 
 class ResidualGraphBuilder(rgenop.LowLevelOpBuilder):

Modified: pypy/dist/pypy/jit/timeshifter/rtyper.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/rtyper.py	(original)
+++ pypy/dist/pypy/jit/timeshifter/rtyper.py	Mon Aug 21 17:54:29 2006
@@ -222,10 +222,10 @@
             # first close the current block
             ts = self.timeshifter
             v_jitstate = hop.llops.getjitstate()
-            hop.llops.genmixlevelhelpercall(rtimeshift.leave_block,
-                                            [ts.s_JITState],
-                                            [v_jitstate],
-                                            ts.s_JITState)
+            v_builder = hop.llops.genmixlevelhelpercall(rtimeshift.before_call,
+                                                        [ts.s_JITState],
+                                                        [v_jitstate],
+                                                     ts.s_ResidualGraphBuilder)
             hop.r_s_popfirstarg()
             args_hs = hop.args_s[:]
             # fixed is always false here
@@ -234,15 +234,14 @@
             args_v = hop.inputargs(*args_r)
             fnptr = self.getcallable(graph)
             self.timeshifter.schedule_graph(graph)
-            v_builder = hop.llops.getcurbuilder()
             args_v.insert(0, v_builder)
             args_v.insert(0, hop.llops.genconst(fnptr))
-            v = hop.genop('direct_call', args_v,
-                          resulttype = ts.r_ResidualGraphBuilder.lowleveltype)
-
-            c_name = inputconst(lltype.Void, 'inst_valuebox')
-            return hop.genop('getfield', [v, c_name],
-                             resulttype = hop.r_result.lowleveltype)
+            v_newbuilder = hop.genop('direct_call', args_v,
+                                     ts.r_ResidualGraphBuilder.lowleveltype)
+            return hop.llops.genmixlevelhelpercall(rtimeshift.after_call,
+                                   [ts.s_JITState, ts.s_ResidualGraphBuilder],
+                                   [v_jitstate,    v_newbuilder],
+                                   ts.s_RedBox)
 
     def handle_highlevel_operation(self, fnobj, hop):
         from pypy.jit.timeshifter.oop import OopSpecDesc, Index



More information about the Pypy-commit mailing list