[pypy-svn] r65079 - in pypy/branch/tagged-pointers-framework/pypy/rpython/memory: gc test
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed May 6 09:55:30 CEST 2009
Author: cfbolz
Date: Wed May 6 09:55:29 2009
New Revision: 65079
Modified:
pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/base.py
pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/generation.py
pypy/branch/tagged-pointers-framework/pypy/rpython/memory/test/test_gc.py
Log:
fix write barrier
Modified: pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/base.py (original)
+++ pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/base.py Wed May 6 09:55:29 2009
@@ -177,8 +177,10 @@
trace._annspecialcase_ = 'specialize:arg(2)'
def points_to_valid_gc_object(self, addr):
- pointsto = addr.address[0]
- return pointsto != NULL and llmemory.cast_adr_to_int(pointsto) & 1 == 0
+ return self.is_valid_gc_object(addr.address[0])
+
+ def is_valid_gc_object(self, addr):
+ return addr != NULL and llmemory.cast_adr_to_int(addr) & 1 == 0
def debug_check_consistency(self):
"""To use after a collection. If self.DEBUG is set, this
Modified: pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/generation.py (original)
+++ pypy/branch/tagged-pointers-framework/pypy/rpython/memory/gc/generation.py Wed May 6 09:55:29 2009
@@ -413,11 +413,11 @@
def remember_young_pointer(self, addr_struct, addr):
ll_assert(not self.is_in_nursery(addr_struct),
"nursery object with GCFLAG_NO_YOUNG_PTRS")
+ if not self.is_valid_gc_object(addr):
+ return
if self.is_in_nursery(addr):
self.old_objects_pointing_to_young.append(addr_struct)
self.header(addr_struct).tid &= ~GCFLAG_NO_YOUNG_PTRS
- elif addr == NULL:
- return
self.write_into_last_generation_obj(addr_struct, addr)
remember_young_pointer._dont_inline_ = True
Modified: pypy/branch/tagged-pointers-framework/pypy/rpython/memory/test/test_gc.py
==============================================================================
--- pypy/branch/tagged-pointers-framework/pypy/rpython/memory/test/test_gc.py (original)
+++ pypy/branch/tagged-pointers-framework/pypy/rpython/memory/test/test_gc.py Wed May 6 09:55:29 2009
@@ -490,11 +490,17 @@
__slots__ = 'smallint'
def meth(self, x):
return self.smallint + x + 3
+
+ class Unrelated(object):
+ pass
+
+ u = Unrelated()
def fn(n):
if n > 0:
x = B(n)
else:
x = C(n)
+ u.x = x # invoke write barrier
rgc.collect()
return x.meth(100)
res = self.interpret(fn, [1000])
More information about the Pypy-commit
mailing list