[pypy-svn] r22801 - in pypy/dist/pypy/rpython/memory: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Jan 28 18:02:39 CET 2006
Author: cfbolz
Date: Sat Jan 28 18:02:37 2006
New Revision: 22801
Modified:
pypy/dist/pypy/rpython/memory/gctransform.py
pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
(mwh, cfbolz):
we finally, maybe, possibly got the issues around exception handling correct.
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Sat Jan 28 18:02:37 2006
@@ -109,12 +109,15 @@
newops.extend(self.pop_alive(var))
for link in block.exits:
livecounts = dict.fromkeys(sets.Set(livevars) - deadinallexits, 1)
- if (block.exitswitch is c_last_exception and link.exitcase is not None
- and livevars and livevars[-1] is block.operations[-1].result):
- # if the last operation in the block raised an
- # exception, it can't have returned anything that
- # might need pop_aliving.
- del livecounts[livevars[-1]]
+ if (block.exitswitch is c_last_exception and
+ link.exitcase is not None):
+ if livevars and livevars[-1] is block.operations[-1].result:
+ # if the last operation in the block raised an
+ # exception, it can't have returned anything that
+ # might need pop_aliving.
+ del livecounts[livevars[-1]]
+ if link.last_exc_value not in link.args:
+ livecounts[link.last_exc_value] = 1
for v in link.args:
if v in livecounts:
livecounts[v] -= 1
Modified: pypy/dist/pypy/rpython/memory/test/test_gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/test/test_gctransform.py Sat Jan 28 18:02:37 2006
@@ -28,15 +28,16 @@
return
for link in block.exits:
fudge = 0
- if (block.exitswitch is c_last_exception and link.exitcase is not None
- and var_needsgc(block.operations[-1].result)):
- fudge = 1
+ if (block.exitswitch is c_last_exception and link.exitcase is not None):
+ fudge -= 1
+ if var_needsgc(block.operations[-1].result):
+ fudge += 1
refs_out = len([v for v in link.args
if isinstance(v, Variable) and var_needsgc(v)])
- if link.last_exception is not None and link.last_exception in link.args:
- refs_out -= 1
assert refs_in + push_alives + calls - fudge == pop_alives + refs_out
-
+
+ if block.exitswitch is c_last_exception and link.exitcase is not None:
+ assert link.last_exc_value in link.args
def rtype_and_transform(func, inputtypes, transformcls, specialize=True):
t = TranslationContext()
More information about the Pypy-commit
mailing list