[pypy-svn] r74841 - pypy/branch/blackhole-improvement/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Fri May 28 12:50:59 CEST 2010


Author: arigo
Date: Fri May 28 12:50:58 2010
New Revision: 74841

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/warmspot.py
Log:
Finish fixing test_recursion.py.


Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py	Fri May 28 12:50:58 2010
@@ -794,17 +794,33 @@
         pass
 
     @arguments("self", "I", "R", "F", "I", "R", "F")
-    def bhimpl_jit_merge_point(self, *results):
+    def bhimpl_jit_merge_point(self, *args):
         if self.nextblackholeinterp is None:    # we are the last level
             CRN = self.builder.metainterp_sd.ContinueRunningNormally
-            raise CRN(*results)
+            raise CRN(*args)
+            # Note that the case above is an optimization: the case
+            # below would work too.  But it keeps unnecessary stuff on
+            # the stack; the solution above first gets rid of the blackhole
+            # interpreter completely.
         else:
             # This occurs when we reach 'jit_merge_point' in the portal
             # function called by recursion.  In this case, we can directly
             # call the interpreter main loop from here, and just return its
             # result.
-            XXX
-            raise LeaveFrame
+            sd = self.builder.metainterp_sd
+            if sd.result_type == 'void':
+                self.bhimpl_recursive_call_v(*args)
+                self.bhimpl_void_return()
+            elif sd.result_type == 'int':
+                x = self.bhimpl_recursive_call_i(*args)
+                self.bhimpl_int_return(x)
+            elif sd.result_type == 'ref':
+                x = self.bhimpl_recursive_call_r(*args)
+                self.bhimpl_ref_return(x)
+            elif sd.result_type == 'float':
+                x = self.bhimpl_recursive_call_f(*args)
+                self.bhimpl_float_return(x)
+            assert False
 
     def get_portal_runner(self):
         metainterp_sd = self.builder.metainterp_sd
@@ -1295,7 +1311,6 @@
         metainterp_sd.blackholeinterpbuilder,
         resumedescr,
         all_virtuals)
-    # XXX virtualizable
     current_exc = blackholeinterp._prepare_resume_from_failure(
         resumedescr.guard_opnum)
     try:

Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/warmspot.py	Fri May 28 12:50:58 2010
@@ -572,11 +572,11 @@
                     loop_token = fail_descr.handle_fail(self.metainterp_sd)
                     fail_descr = self.cpu.execute_token(loop_token)
                 except self.ContinueRunningNormally, e:
-                    xxxxxxxxx
                     args = ()
-                    for _, name, _ in portalfunc_ARGS:
-                        v = getattr(e, name)
-                        args = args + (v,)
+                    for ARGTYPE, attrname, count in portalfunc_ARGS:
+                        x = getattr(e, attrname)[count]
+                        x = specialize_value(ARGTYPE, x)
+                        args = args + (x,)
                     return ll_portal_runner(*args)
                 except self.DoneWithThisFrameVoid:
                     assert result_kind == 'void'



More information about the Pypy-commit mailing list