[pypy-svn] r64577 - pypy/branch/pyjitpl5/pypy/jit/metainterp

fijal at codespeak.net fijal at codespeak.net
Wed Apr 22 18:56:01 CEST 2009


Author: fijal
Date: Wed Apr 22 18:56:00 2009
New Revision: 64577

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
Log:
add some detection logic to get rid of entering can_enter_jit when inside a
BlackHole. This can only happen when can_enter_jit is somewhere else than
in the main interpreter loop and it causes jit exceptions to be propagated
through the whole interpreter without ll_portal catching them.


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	Wed Apr 22 18:56:00 2009
@@ -867,6 +867,9 @@
 # ____________________________________________________________
 
 class MetaInterpGlobalData(object):
+
+    blackhole = False
+    
     def __init__(self):
         self.metainterp_doing_call = None
         self._debug_history = []
@@ -1282,6 +1285,7 @@
                 self.history.operations.append(suboperations[i])
             self.extra_rebuild_operations = extra
         else:
+            self.staticdata.globaldata.blackhole = True
             self.history = history.BlackHole(self.cpu)
             # the BlackHole is invalid because it doesn't start with
             # guard_failure.key.guard_op.suboperations, but that's fine

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/warmspot.py	Wed Apr 22 18:56:00 2009
@@ -189,6 +189,8 @@
 
         def maybe_enter_jit(*args):
             try:
+                if self.metainterp_sd.globaldata.blackhole:
+                    return
                 state.maybe_compile_and_run(*args)
             except JitException:
                 raise     # go through
@@ -321,22 +323,25 @@
         def ll_portal_runner(*args):
             while 1:
                 try:
-                    return support.maybe_on_top_of_llinterp(rtyper,
-                                                      portal_ptr)(*args)
-                except ContinueRunningNormally, e:
-                    args = ()
-                    for i, ARG in portalfunc_ARGS:
-                        v = unwrap(ARG, e.args[i])
-                        args = args + (v,)
-                except DoneWithThisFrame, e:
-                    return unwrap(RESULT, e.resultbox)
-                except ExitFrameWithException, e:
-                    value = e.valuebox.getptr(lltype.Ptr(rclass.OBJECT))
-                    if not we_are_translated():
-                        raise LLException(value.typeptr, value)
-                    else:
-                        value = cast_base_ptr_to_instance(Exception, value)
-                        raise Exception, value
+                    try:
+                        return support.maybe_on_top_of_llinterp(rtyper,
+                                                          portal_ptr)(*args)
+                    except ContinueRunningNormally, e:
+                        args = ()
+                        for i, ARG in portalfunc_ARGS:
+                            v = unwrap(ARG, e.args[i])
+                            args = args + (v,)
+                    except DoneWithThisFrame, e:
+                        return unwrap(RESULT, e.resultbox)
+                    except ExitFrameWithException, e:
+                        value = e.valuebox.getptr(lltype.Ptr(rclass.OBJECT))
+                        if not we_are_translated():
+                            raise LLException(value.typeptr, value)
+                        else:
+                            value = cast_base_ptr_to_instance(Exception, value)
+                            raise Exception, value
+                finally:
+                    self.metainterp_sd.globaldata.blackhole = False
         ll_portal_runner._recursive_portal_call_ = True
 
         portal_runner_ptr = self.helper_func(self.PTR_PORTAL_FUNCTYPE,



More information about the Pypy-commit mailing list