Author: Armin Rigo <ar...@tunes.org>
Branch: jitframe-on-heap
Changeset: r62001:53913ed189c9
Date: 2013-03-04 11:17 +0100
http://bitbucket.org/pypy/pypy/changeset/53913ed189c9/

Log:    Fix: for debugging check we verify that ebp points to a JITFRAME
        here; but it may actually point to an already-forwarded object at
        this point.

diff --git a/rpython/memory/gc/minimark.py b/rpython/memory/gc/minimark.py
--- a/rpython/memory/gc/minimark.py
+++ b/rpython/memory/gc/minimark.py
@@ -940,6 +940,11 @@
     def get_forwarding_address(self, obj):
         return llmemory.cast_adr_to_ptr(obj, FORWARDSTUBPTR).forw
 
+    def get_possibly_forwarded_type_id(self, obj):
+        if self.is_in_nursery(obj) and self.is_forwarded(obj):
+            obj = self.get_forwarding_address(obj)
+        return self.get_type_id(obj)
+
     def get_total_memory_used(self):
         """Return the total memory used, not counting any object in the
         nursery: only objects in the ArenaCollection or raw-malloced.
diff --git a/rpython/memory/gc/semispace.py b/rpython/memory/gc/semispace.py
--- a/rpython/memory/gc/semispace.py
+++ b/rpython/memory/gc/semispace.py
@@ -438,6 +438,12 @@
     def visit_external_object(self, obj):
         pass    # hook for the HybridGC
 
+    def get_possibly_forwarded_type_id(self, obj):
+        tid = self.header(obj).tid
+        if self.is_forwarded(obj) and not (tid & GCFLAG_EXTERNAL):
+            obj = self.get_forwarding_address(obj)
+        return self.get_type_id(obj)
+
     def set_forwarding_address(self, obj, newobj, objsize):
         # To mark an object as forwarded, we set the GCFLAG_FORWARDED and
         # overwrite the object with a FORWARDSTUB.  Doing so is a bit
diff --git a/rpython/memory/gctransform/asmgcroot.py 
b/rpython/memory/gctransform/asmgcroot.py
--- a/rpython/memory/gctransform/asmgcroot.py
+++ b/rpython/memory/gctransform/asmgcroot.py
@@ -413,7 +413,7 @@
             # to a JITFRAME object.
             from rpython.jit.backend.llsupport.jitframe import STACK_DEPTH_OFS
             
-            tid = self.gc.get_type_id(ebp_in_caller)
+            tid = self.gc.get_possibly_forwarded_type_id(ebp_in_caller)
             ll_assert(rffi.cast(lltype.Signed, tid) ==
                       rffi.cast(lltype.Signed, self.frame_tid),
                       "found a stack frame that does not belong "
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to