[pypy-svn] r74909 - in pypy/branch/blackhole-improvement/pypy/jit: backend backend/llgraph backend/llsupport metainterp

arigo at codespeak.net arigo at codespeak.net
Sun May 30 12:56:20 CEST 2010


Author: arigo
Date: Sun May 30 12:56:18 2010
New Revision: 74909

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/backend/llgraph/llimpl.py
   pypy/branch/blackhole-improvement/pypy/jit/backend/llsupport/llmodel.py
   pypy/branch/blackhole-improvement/pypy/jit/backend/model.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py
Log:
Change grab_exc_value() to return a GCREF.


Modified: pypy/branch/blackhole-improvement/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/backend/llgraph/llimpl.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/backend/llgraph/llimpl.py	Sun May 30 12:56:18 2010
@@ -1096,9 +1096,9 @@
     if _last_exception is not None:
         result = _last_exception.args[1]
         _last_exception = None
-        return result
+        return lltype.cast_opaque_ptr(llmemory.GCREF, result)
     else:
-        return lltype.nullptr(rclass.OBJECTPTR.TO)
+        return lltype.nullptr(llmemory.GCREF.TO)
 
 ##_pseudo_exceptions = {}
 
@@ -1519,7 +1519,7 @@
 setannotation(frame_get_value_count, annmodel.SomeInteger())
 setannotation(frame_clear_latest_values, annmodel.s_None)
 
-setannotation(grab_exc_value, annmodel.SomePtr(rclass.OBJECTPTR))
+setannotation(grab_exc_value, annmodel.SomePtr(llmemory.GCREF))
 setannotation(force, annmodel.SomeInteger())
 setannotation(get_forced_token_frame, s_Frame)
 setannotation(get_frame_forced_token, annmodel.SomeAddress())

Modified: pypy/branch/blackhole-improvement/pypy/jit/backend/llsupport/llmodel.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/backend/llsupport/llmodel.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/backend/llsupport/llmodel.py	Sun May 30 12:56:18 2010
@@ -50,7 +50,7 @@
             self._setup_exception_handling_translated()
         else:
             self._setup_exception_handling_untranslated()
-        self.saved_exc_value = lltype.nullptr(rclass.OBJECT)
+        self.saved_exc_value = lltype.nullptr(llmemory.GCREF.TO)
         self.setup()
         if translate_support_code:
             self._setup_on_leave_jitted_translated()
@@ -107,7 +107,7 @@
             v_i = _exception_emulator[1]
             _exception_emulator[0] = 0
             _exception_emulator[1] = 0
-            self.saved_exc_value = rffi.cast(rclass.OBJECTPTR, v_i)
+            self.saved_exc_value = rffi.cast(llmemory.GCREF, v_i)
 
         self.pos_exception = pos_exception
         self.pos_exc_value = pos_exc_value
@@ -128,7 +128,7 @@
             addr = llop.get_exception_addr(llmemory.Address)
             addr.address[0] = llmemory.NULL
             addr = llop.get_exc_value_addr(llmemory.Address)
-            exc_value = rffi.cast(rclass.OBJECTPTR, addr.address[0])
+            exc_value = rffi.cast(llmemory.GCREF, addr.address[0])
             addr.address[0] = llmemory.NULL
             # from now on, the state is again consistent -- no more RPython
             # exception is set.  The following code produces a write barrier
@@ -172,7 +172,7 @@
 
     def grab_exc_value(self):
         exc = self.saved_exc_value
-        self.saved_exc_value = lltype.nullptr(rclass.OBJECT)
+        self.saved_exc_value = lltype.nullptr(llmemory.GCREF.TO)
         return exc
 
     # ------------------- helpers and descriptions --------------------

Modified: pypy/branch/blackhole-improvement/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/backend/model.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/backend/model.py	Sun May 30 12:56:18 2010
@@ -105,7 +105,7 @@
     def grab_exc_value(self):
         """Return and clear the exception set by the latest execute_token(),
         when it exits due to a failure of a GUARD_EXCEPTION or
-        GUARD_NO_EXCEPTION."""        # XXX remove me
+        GUARD_NO_EXCEPTION.  (Returns a GCREF)"""        # XXX remove me
         raise NotImplementedError
 
     @staticmethod

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	Sun May 30 12:56:18 2010
@@ -1221,7 +1221,8 @@
         elif (opnum == rop.GUARD_NO_EXCEPTION or
               opnum == rop.GUARD_EXCEPTION or
               opnum == rop.GUARD_NOT_FORCED):
-            return self.cpu.grab_exc_value()
+            return lltype.cast_opaque_ptr(rclass.OBJECTPTR,
+                                          self.cpu.grab_exc_value())
         #
         elif opnum == rop.GUARD_NO_OVERFLOW:
             # Produced by int_xxx_ovf().  The pc is just after the opcode.

Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/pyjitpl.py	Sun May 30 12:56:18 2010
@@ -1,5 +1,5 @@
 import py, os
-from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.lltypesystem import lltype, llmemory, rclass
 from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.debug import debug_start, debug_stop, debug_print
@@ -1642,7 +1642,8 @@
         elif opnum == rop.GUARD_NO_EXCEPTION or opnum == rop.GUARD_EXCEPTION:
             exception = self.cpu.grab_exc_value()
             if exception:
-                self.execute_ll_raised(exception)
+                self.execute_ll_raised(lltype.cast_opaque_ptr(rclass.OBJECTPTR,
+                                                              exception))
             else:
                 self.execute_did_not_raise()
             try:



More information about the Pypy-commit mailing list