[pypy-svn] r63807 - in pypy/branch/pyjitpl5-simplify/pypy/jit: backend/llgraph metainterp

fijal at codespeak.net fijal at codespeak.net
Tue Apr 7 22:40:19 CEST 2009


Author: fijal
Date: Tue Apr  7 22:40:16 2009
New Revision: 63807

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
Log:
hack it differently. now it works on top of x86 backend and it's a bit more
efficient as well.


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py	Tue Apr  7 22:40:16 2009
@@ -118,7 +118,6 @@
     'strsetitem'      : (('ptr', 'int', 'int'), None),
     'cast_ptr_to_int' : (('ptr',), 'int'),
     'cast_int_to_ptr' : (('int',), 'ptr'),
-    'get_exc_value'   : ((), 'ptr'),
     #'getitem'         : (('void', 'ptr', 'int'), 'int'),
     #'setitem'         : (('void', 'ptr', 'int', 'int'), None),
     #'newlist'         : (('void', 'varargs'), 'ptr'),
@@ -542,6 +541,7 @@
             raise GuardFailed
 
     def _check_exception(self, expected_exception):
+        global _last_exception
         expected_exception = llmemory.cast_adr_to_ptr(
             cast_int_to_adr(self.memocast, expected_exception),
             rclass.CLASSTYPE)
@@ -556,13 +556,21 @@
             return False
 
     def op_guard_exception(self, _, expected_exception):
+        global _last_exception
         if not self._check_exception(expected_exception):
             raise GuardFailed
+        res = _last_exception[1]
+        _last_exception = None
+        return res
 
     def op_guard_exception_inverse(self, _, expected_exception):
+        global _last_exception
         if self._check_exception(expected_exception):
             raise GuardFailed
-
+        res = _last_exception[1]
+        _last_exception = None
+        return res
+    
     # ----------
     # delegating to the builtins do_xxx() (done automatically for simple cases)
 
@@ -642,12 +650,6 @@
     def op_uint_xor(self, descr, arg1, arg2):
         return arg1 ^ arg2
 
-    def op_get_exc_value(self, descr):
-        exc_value = get_exc_value()
-        assert exc_value    # should be guarded
-        clear_exception()
-        return exc_value
-
 # ____________________________________________________________
 
 def cast_to_int(x, memocast):

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	Tue Apr  7 22:40:16 2009
@@ -349,12 +349,6 @@
         return history.BoxInt(llimpl.cast_to_int(args[0].getptr_base(),
                                                         self.memo_cast))
 
-    def do_get_exc_value(self, args, descr=None):
-        exc_value = llimpl.get_exc_value()
-        assert exc_value    # should be guarded
-        llimpl.clear_exception()
-        return history.BoxPtr(exc_value)
-
 # ____________________________________________________________
 
 import pypy.jit.metainterp.executor

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	Tue Apr  7 22:40:16 2009
@@ -1088,9 +1088,10 @@
         if etype:
             exception_box = ConstInt(etype)
             exc_value_box = BoxPtr(evalue)
-            frame.generate_guard(frame.pc, rop.GUARD_EXCEPTION,
-                                 None, [exception_box])
-            self.history.record(rop.GET_EXC_VALUE, [], exc_value_box)
+            op = frame.generate_guard(frame.pc, rop.GUARD_EXCEPTION,
+                                      None, [exception_box])
+            if op:
+                op.result = exc_value_box
             return self.finishframe_exception(exception_box, exc_value_box)
         else:
             frame.generate_guard(frame.pc, rop.GUARD_NO_EXCEPTION, None, [])

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py	Tue Apr  7 22:40:16 2009
@@ -165,7 +165,6 @@
     GETARRAYITEM_GC        = 83
     GETFIELD_GC            = 84
     GETFIELD_RAW           = 85
-    GET_EXC_VALUE          = 86
     _NOSIDEEFFECT_LAST = 89 # ----- end of no_side_effect operations -----
 
     NEW                    = 90



More information about the Pypy-commit mailing list