[pypy-commit] pypy gc-pinning: modify can_move() and add pin() and unpin()

wenzhuman noreply at buildbot.pypy.org
Mon Jun 2 10:03:06 CEST 2014


Author: wenzhuman <manwenzhu at gmail.com>
Branch: gc-pinning
Changeset: r71804:6f41a99edd76
Date: 2014-06-02 04:01 -0400
http://bitbucket.org/pypy/pypy/changeset/6f41a99edd76/

Log:	modify can_move() and add pin() and unpin()

diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -165,6 +165,7 @@
 
 class IncrementalMiniMarkGC(MovingGCBase):
     _alloc_flavor_ = "raw"
+    can_pin_objects = True
     inline_simple_malloc = True
     inline_simple_malloc_varsize = True
     needs_write_barrier = True
@@ -884,7 +885,13 @@
 
     def can_move(self, obj):
         """Overrides the parent can_move()."""
-        return self.is_in_nursery(obj)
+        return (self.is_in_nursery(obj) & not self.header(obj).tid & GCFLAG_PINNED)
+
+    def pin(self, obj):
+        self.header(obj).tid |= GCFLAG_PINNED
+
+    def unpin(self, obj):
+        self.header(obj).tid &= ~GCFLAG_PINNED
 
 
     def shrink_array(self, obj, smallerlength):


More information about the pypy-commit mailing list