[pypy-commit] pypy gc-incminimark-pinning: add test for missing feature. fails for now.
groggi
noreply at buildbot.pypy.org
Mon Jun 30 16:11:11 CEST 2014
Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning
Changeset: r72290:dbcb81255e80
Date: 2014-06-30 16:09 +0200
http://bitbucket.org/pypy/pypy/changeset/dbcb81255e80/
Log: add test for missing feature. fails for now.
diff --git a/rpython/memory/gc/test/test_object_pinning.py b/rpython/memory/gc/test/test_object_pinning.py
--- a/rpython/memory/gc/test/test_object_pinning.py
+++ b/rpython/memory/gc/test/test_object_pinning.py
@@ -109,6 +109,31 @@
# ^^^ should not be possible, struct is already old and won't
# move.
+ def test_old_points_to_pinned(self):
+ # Test if we handle the case that an old object can point
+ # to a pinned object and keeps the pinned object alive by
+ # that.
+ #
+ # create the old object that will point to a pinned object
+ old_ptr = self.malloc(S)
+ self.stackroots.append(old_ptr)
+ self.gc.collect()
+ assert not self.gc.is_in_nursery(llmemory.cast_ptr_to_adr(self.stackroots[0]))
+ #
+ # create the young pinned object and attach it to the old object
+ pinned_ptr = self.malloc(S)
+ assert self.gc.pin(llmemory.cast_ptr_to_adr(pinned_ptr))
+ self.write(self.stackroots[0], 'next', pinned_ptr)
+ #
+ # let's check if everything stays in place before/after a collection
+ assert self.gc.is_in_nursery(llmemory.cast_ptr_to_adr(pinned_ptr))
+ self.gc.collect()
+ assert self.gc.is_in_nursery(llmemory.cast_ptr_to_adr(pinned_ptr))
+ #
+ self.stackroots[0].next.someInt = 100
+ self.gc.collect()
+ assert self.stackroots[0].next.someInt == 100
+
def test_pin_malloc_pin(self):
first_ptr = self.malloc(S)
first_ptr.someInt = 101
More information about the pypy-commit
mailing list