[pypy-commit] pypy stm-thread-2: Add a can_move() for the JIT.

arigo noreply at buildbot.pypy.org
Tue Sep 11 14:35:37 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57272:296bf379ee86
Date: 2012-09-10 14:23 +0200
http://bitbucket.org/pypy/pypy/changeset/296bf379ee86/

Log:	Add a can_move() for the JIT.

diff --git a/pypy/rpython/memory/gc/stmgc.py b/pypy/rpython/memory/gc/stmgc.py
--- a/pypy/rpython/memory/gc/stmgc.py
+++ b/pypy/rpython/memory/gc/stmgc.py
@@ -357,6 +357,15 @@
             # XXX improve hash(nursery_object)
             return mangle_hash(llmemory.cast_adr_to_int(obj))
 
+    def can_move(self, obj):
+        tls = self.get_tls()
+        if tls.is_in_nursery(addr):
+            return True
+        else:
+            # XXX for now a pointer to a non-nursery object is
+            # always valid, as long as we don't have global collections
+            return False
+
 # ____________________________________________________________
 # helpers
 


More information about the pypy-commit mailing list