Author: wenzhuman <[email protected]>
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):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to