[pypy-commit] stmgc c8-hashtable: Initialize the stm_flags of the copies too (by copying the seg0

arigo noreply at buildbot.pypy.org
Wed Mar 11 10:36:31 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: c8-hashtable
Changeset: r1717:9099a4a94924
Date: 2015-03-11 10:37 +0100
http://bitbucket.org/pypy/stmgc/changeset/9099a4a94924/

Log:	Initialize the stm_flags of the copies too (by copying the seg0
	version) (thanks Remi)

diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c
--- a/c8/stm/gcpage.c
+++ b/c8/stm/gcpage.c
@@ -142,13 +142,15 @@
     uintptr_t nobj = (uintptr_t)np;
     dprintf(("allocate_preexisting: %p\n", (object_t *)nobj));
 
-    char *dest = stm_object_pages + nobj;
-    memcpy(dest, initial_data, size_rounded_up);
-    ((struct object_s *)dest)->stm_flags = GCFLAG_WRITE_BARRIER;
+    DEBUG_EXPECT_SEGFAULT(false);
+
+    char *nobj_seg0 = stm_object_pages + nobj;
+    memcpy(nobj_seg0, initial_data, size_rounded_up);
+    ((struct object_s *)nobj_seg0)->stm_flags = GCFLAG_WRITE_BARRIER;
 
     long j;
     for (j = 1; j < NB_SEGMENTS; j++) {
-        const char *src = initial_data;
+        const char *src = nobj_seg0;
         char *dest = get_segment_base(j) + nobj;
         char *end = dest + size_rounded_up;
 
@@ -174,6 +176,7 @@
 
     write_fence();     /* make sure 'nobj' is fully initialized from
                           all threads here */
+    DEBUG_EXPECT_SEGFAULT(true);
     return (object_t *)nobj;
 }
 


More information about the pypy-commit mailing list