[pypy-commit] pypy continulet-jit-3: Fixes

fijal noreply at buildbot.pypy.org
Fri Oct 19 17:04:13 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: continulet-jit-3
Changeset: r58244:c88aa317024c
Date: 2012-10-19 16:39 +0200
http://bitbucket.org/pypy/pypy/changeset/c88aa317024c/

Log:	Fixes

diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -236,10 +236,21 @@
         return frame.latest_descr
 
     def get_finish_value_int(self, frame):
-        return frame.finish_value
+        res = frame.finish_value
+        del frame.finish_value
+        return res
     get_finish_value_float = get_finish_value_int
     get_finish_value_ref   = get_finish_value_int
 
+    def grab_exc_value(self, frame):
+        if frame.last_exception is not None:
+            result = frame.last_exception.args[1]
+            gcref = lltype.cast_opaque_ptr(llmemory.GCREF, result)
+        else:
+            gcref = lltype.nullptr(llmemory.GCREF.TO)
+        frame.last_exception = None
+        return gcref
+
     def force(self, frame):
         assert not frame._forced
         frame._forced = True
@@ -547,6 +558,7 @@
     
     _forced = False
     _execution_finished = False
+    finish_value = None
     
     def __init__(self, cpu, argboxes, args):
         self.env = {}
@@ -633,14 +645,7 @@
 
     # -----------------------------------------------------
 
-    def fail_guard(self, descr, saveexc=False):
-        if saveexc:
-            if self.last_exception is not None:
-                result = self.last_exception.args[1]
-                gcref = lltype.cast_opaque_ptr(llmemory.GCREF, result)
-            else:
-                gcref = lltype.nullptr(llmemory.GCREF.TO)
-            self.finish_value = gcref
+    def fail_guard(self, descr):
         raise GuardFailed(self._getfailargs(), descr)
 
     def execute_finish(self, descr, arg=None):
@@ -688,7 +693,7 @@
 
     def execute_guard_no_exception(self, descr):
         if self.last_exception is not None:
-            self.fail_guard(descr, saveexc=True)
+            self.fail_guard(descr)
 
     def execute_guard_exception(self, descr, excklass):
         lle = self.last_exception
@@ -700,7 +705,7 @@
             llmemory.cast_int_to_adr(excklass),
             rclass.CLASSTYPE)
         if gotklass != excklass:
-            self.fail_guard(descr, saveexc=True)
+            self.fail_guard(descr)
         #
         res = lle.args[1]
         self.last_exception = None
diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py
--- a/pypy/jit/metainterp/blackhole.py
+++ b/pypy/jit/metainterp/blackhole.py
@@ -1419,7 +1419,7 @@
               opnum == rop.GUARD_EXCEPTION or
               opnum == rop.GUARD_NOT_FORCED):
             return lltype.cast_opaque_ptr(rclass.OBJECTPTR,
-                        self.cpu.get_finish_value_ref(jitframe))
+                        self.cpu.grab_exc_value(jitframe))
         #
         elif opnum == rop.GUARD_NO_OVERFLOW:
             # Produced by int_xxx_ovf().  The pc is just after the opcode.
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -2109,7 +2109,7 @@
               opnum == rop.GUARD_NONNULL_CLASS):
             pass        # the pc is already set to the *start* of the opcode
         elif opnum == rop.GUARD_NO_EXCEPTION or opnum == rop.GUARD_EXCEPTION:
-            exception = self.cpu.get_finish_value_ref(jitframe)
+            exception = self.cpu.grab_exc_value(jitframe)
             if exception:
                 self.execute_ll_raised(lltype.cast_opaque_ptr(rclass.OBJECTPTR,
                                                               exception))


More information about the pypy-commit mailing list