Author: Armin Rigo <ar...@tunes.org>
Branch: issue2752
Changeset: r94327:f54cc653fb4a
Date: 2018-04-14 20:55 +0200
http://bitbucket.org/pypy/pypy/changeset/f54cc653fb4a/

Log:    fix 2ef33ef89243

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
@@ -736,9 +736,14 @@
             shadow = self.nursery_objects_shadows.get(obj)
             ll_assert(shadow != llmemory.NULL,
                       "GCFLAG_HAS_SHADOW but no shadow found")
-            return shadow
+        else:
+            shadow = self._allocate_shadow(obj)
 
-        return self._allocate_shadow(obj, copy=True)
+        if (self.header(obj).tid & GCFLAG_SHADOW_INITIALIZED) == 0:
+            self.header(obj).tid |= GCFLAG_SHADOW_INITIALIZED
+            totalsize = self.get_size(obj)
+            llmemory.raw_memcopy(obj, shadow, totalsize)
+        return shadow
 
     def collect(self, gen=2):
         """Do a minor (gen=0), start a major (gen=1), or do a full
@@ -2645,7 +2650,7 @@
     # id() and identityhash() support
 
     @specialize.arg(2)
-    def _allocate_shadow(self, obj, copy=False):
+    def _allocate_shadow(self, obj):
         size_gc_header = self.gcheaderbuilder.size_gc_header
         size = self.get_size(obj)
         shadowhdr = self._malloc_out_of_nursery(size_gc_header +
@@ -2667,12 +2672,6 @@
         #
         self.header(obj).tid |= GCFLAG_HAS_SHADOW
         self.nursery_objects_shadows.setitem(obj, shadow)
-
-        if copy:
-            self.header(obj).tid |= GCFLAG_SHADOW_INITIALIZED
-            totalsize = self.get_size(obj)
-            llmemory.raw_memcopy(obj, shadow, totalsize)
-
         return shadow
 
     def _find_shadow(self, obj):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to