[pypy-svn] r26871 - in pypy/dist/pypy: rpython translator/backendopt

arigo at codespeak.net arigo at codespeak.net
Sat May 6 15:06:44 CEST 2006


Author: arigo
Date: Sat May  6 15:06:42 2006
New Revision: 26871

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/translator/backendopt/propagate.py
Log:
Cleanups.  Details.


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Sat May  6 15:06:42 2006
@@ -351,10 +351,7 @@
                             break
                     else:
                         raise TypeError("the operation %s is not expected to raise %s" % (operation, exc))
-            self.handle_cleanup(operation, exception=True)
             raise
-        else:
-            self.handle_cleanup(operation)
         self.setvar(operation.result, retval)
         if tracer:
             if retval is None:
@@ -362,16 +359,6 @@
             else:
                 tracer.dump('   ---> %r\n' % (retval,))
 
-    def handle_cleanup(self, operation, exception=False):
-        cleanup = getattr(operation, 'cleanup', None)
-        if cleanup is not None:
-            cleanup_finally, cleanup_except = cleanup
-            for op in cleanup_finally:
-                self.eval_operation(op)
-            if exception:
-                for op in cleanup_except:
-                    self.eval_operation(op)
-
     def make_llexception(self, exc=None):
         if exc is None:
             original = sys.exc_info()

Modified: pypy/dist/pypy/translator/backendopt/propagate.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/propagate.py	(original)
+++ pypy/dist/pypy/translator/backendopt/propagate.py	Sat May  6 15:06:42 2006
@@ -134,6 +134,10 @@
         return super(CountingLLFrame, self).eval_operation(operation)
 
 def op_dont_fold(op):
+    if op.opname in ('getfield', 'getarrayitem'):
+        CONTAINER = op.args[0].concretetype.TO
+        if CONTAINER._hints.get('immutable'):
+            return False
     try:
         return not lloperation.LL_OPERATIONS[op.opname].canfold
     except KeyError:



More information about the Pypy-commit mailing list