Author: Gregor Wegberg <[email protected]>
Branch: gc-incminimark-pinning
Changeset: r71829:8785c1ae62ff
Date: 2014-05-19 21:25 +0200
http://bitbucket.org/pypy/pypy/changeset/8785c1ae62ff/

Log:    imported test from gc-minimark-pinning branch

        test_pin_1 from that older branch not importated as yet unclear what
        the exact use-case is or if it even adds something to the test set

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
@@ -135,6 +135,27 @@
         self.gc.collect()
         assert ptr.someInt == 100
 
+    def test_pin_shadow_3(self):
+        s = self.malloc(S)
+        self.stackroots.append(s)
+        self.gc.id(s) # allocate shadow
+        self.gc.pin(llmemory.cast_ptr_to_adr(s))
+        
+        print("free: %s" % self.gc.nursery_free)
+        print("top: %s" % self.gc.nursery_top)
+        self.gc.minor_collection()
+        # XXX it seems like we adjust nursery_free wrong after the minor
+        # collection or there is some other bug. (groggi)
+        print("free: %s" % self.gc.nursery_free)
+        print("top: %s" % self.gc.nursery_top)
+
+        self.gc.unpin(llmemory.cast_ptr_to_adr(s))
+        assert self.gc.nursery_free != self.gc.nursery
+        # we still have a pinned object
+        self.gc.minor_collection()
+        assert self.gc.nursery_free == self.gc.nursery
+        # we don't have a pinned object any more
+
     # XXX test/define what happens if we try to pin an object that is too
     # big for the nursery and will be raw-malloc'ed.
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to