[pypy-svn] r68279 - in pypy/branch/gc-compress/pypy: rpython/lltypesystem translator/c
arigo at codespeak.net
arigo at codespeak.net
Fri Oct 9 16:50:11 CEST 2009
Author: arigo
Date: Fri Oct 9 16:50:10 2009
New Revision: 68279
Modified:
pypy/branch/gc-compress/pypy/rpython/lltypesystem/llgroup.py
pypy/branch/gc-compress/pypy/translator/c/node.py
Log:
Don't raise immediately "structure is part of two groups".
Needed for tests. Now it just marks the old group as
outdated when a structure it contains is also inserted into
a new group, and translator/c complains if writing an
outdated group.
Modified: pypy/branch/gc-compress/pypy/rpython/lltypesystem/llgroup.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/lltypesystem/llgroup.py (original)
+++ pypy/branch/gc-compress/pypy/rpython/lltypesystem/llgroup.py Fri Oct 9 16:50:10 2009
@@ -16,6 +16,7 @@
class group(lltype._container):
_TYPE = Group
+ outdated = None
def __init__(self, name):
self.name = name
@@ -26,7 +27,10 @@
assert isinstance(TYPE.TO, lltype.Struct)
assert TYPE.TO._gckind == 'raw'
struct = structptr._as_obj()
- assert struct not in _membership,"cannot be a member of several groups"
+ prevgroup = _membership.get(struct)
+ if prevgroup is not None:
+ prevgroup.outdated = (
+ "structure %s was inserted into another group" % (struct,))
assert struct._parentstructure() is None
index = len(self.members)
self.members.append(struct)
Modified: pypy/branch/gc-compress/pypy/translator/c/node.py
==============================================================================
--- pypy/branch/gc-compress/pypy/translator/c/node.py (original)
+++ pypy/branch/gc-compress/pypy/translator/c/node.py Fri Oct 9 16:50:10 2009
@@ -921,6 +921,8 @@
yield member._as_ptr()
def _fix_members(self):
+ if self.obj.outdated:
+ raise Exception(self.obj.outdated)
if self.count_members is None:
self.count_members = len(self.obj.members)
else:
More information about the Pypy-commit
mailing list