[pypy-svn] r24502 - pypy/dist/pypy/rpython/memory

tismer at codespeak.net tismer at codespeak.net
Fri Mar 17 05:36:15 CET 2006

Author: tismer
Date: Fri Mar 17 05:36:04 2006
New Revision: 24502

a quick hack to make the protect operations correct.
There is currently an ambiguity in handling certain situations,
since we loose information after operations are rewritten.
Actually, the fact that gc_protect is implemented by a direct_call,
this should not mean that this call can raise.

Modified: pypy/dist/pypy/rpython/memory/gctransform.py
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Fri Mar 17 05:36:04 2006
@@ -12,6 +12,7 @@
 import sets, os
 EXCEPTION_RAISING_OPS = ['direct_call', 'indirect_call']
+NEVER_RAISING_OPS = ['gc_protect', 'gc_unprotect']
 def var_needsgc(var):
     if hasattr(var, 'concretetype'):
@@ -113,9 +114,11 @@
             if not ops:
                 continue # may happen when we eat gc_protect/gc_unprotect.
+            origname = op.opname
             op = ops[-1-num_ops_after_exc_raising]
             # XXX for now we assume that everything can raise
-            if 1 or op.opname in EXCEPTION_RAISING_OPS:
+            # XXX quick hack to make the protect stuff not add exception handling
+            if origname not in NEVER_RAISING_OPS and (1 or op.opname in EXCEPTION_RAISING_OPS):
                 if tuple(livevars) in livevars2cleanup:
                     cleanup_on_exception = livevars2cleanup[tuple(livevars)]

More information about the Pypy-commit mailing list