[pypy-svn] r22834 - in pypy/dist/pypy/rpython/memory: . test
mwh at codespeak.net
mwh at codespeak.net
Sun Jan 29 13:50:33 CET 2006
Author: mwh
Date: Sun Jan 29 13:50:31 2006
New Revision: 22834
Modified:
pypy/dist/pypy/rpython/memory/gctransform.py
pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
surprise surprise, carl and i didn't get all the details
of refcounting right yesterday -- Constants that need GC
handling need to be push_alived before sending them across
link.
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Sun Jan 29 13:50:31 2006
@@ -1,5 +1,5 @@
from pypy.rpython.lltypesystem import lltype
-from pypy.objspace.flow.model import SpaceOperation, Variable, c_last_exception
+from pypy.objspace.flow.model import SpaceOperation, Variable, Constant, c_last_exception
from pypy.translator.unsimplify import insert_empty_block
from pypy.rpython import rmodel
import sets
@@ -116,11 +116,13 @@
# 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
+ livecounts[link.last_exc_value] = 1
for v in link.args:
if v in livecounts:
livecounts[v] -= 1
+ elif var_needsgc(v):
+ assert isinstance(v, Constant)
+ livecounts[v] = -1
self.links_to_split[link] = livecounts
if newops:
block.operations = newops
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 Sun Jan 29 13:50:31 2006
@@ -1,5 +1,5 @@
from pypy.rpython.memory import gctransform
-from pypy.objspace.flow.model import c_last_exception
+from pypy.objspace.flow.model import c_last_exception, Variable
from pypy.rpython.memory.gctransform import var_needsgc, var_ispyobj
from pypy.translator.translator import TranslationContext, graphof
from pypy.rpython.lltypesystem import lltype
@@ -13,7 +13,7 @@
if block.isstartblock:
refs_in = 0
else:
- refs_in = len([v for v in block.inputargs if var_needsgc(v)])
+ refs_in = len([v for v in block.inputargs if isinstance(v, Variable) and var_needsgc(v)])
push_alives = len([op for op in block.operations
if op.opname.startswith('gc_push_alive')]) + \
len([op for op in block.operations
@@ -32,8 +32,7 @@
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)])
+ refs_out = len([v for v in link.args if var_needsgc(v)])
assert refs_in + push_alives + calls - fudge == pop_alives + refs_out
if block.exitswitch is c_last_exception and link.exitcase is not None:
More information about the Pypy-commit
mailing list