[pypy-commit] stmgc c8-new-page-handling: fix reset_modified_from_backup_copies()
arigo
noreply at buildbot.pypy.org
Tue Sep 23 18:50:34 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: c8-new-page-handling
Changeset: r1411:f36b2595f248
Date: 2014-09-23 18:50 +0200
http://bitbucket.org/pypy/stmgc/changeset/f36b2595f248/
Log: fix reset_modified_from_backup_copies()
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -601,29 +601,36 @@
#pragma push_macro("STM_SEGMENT")
#undef STM_PSEGMENT
#undef STM_SEGMENT
- acquire_modified_objs_lock(segment_num);
+ //acquire_modified_objs_lock(segment_num);
struct stm_priv_segment_info_s *pseg = get_priv_segment(segment_num);
- abort();
- struct tree_s *tree = NULL; //XXX pseg->modified_old_objects;
- wlog_t *item;
- TREE_LOOP_FORWARD(tree, item); {
- object_t *obj = (object_t*)item->addr;
- struct object_s* bk_obj = (struct object_s *)item->val;
- size_t obj_size;
+ struct list_s *list = pseg->modified_old_objects;
+ struct stm_undo_s *undo = (struct stm_undo_s *)list->items;
+ struct stm_undo_s *end = (struct stm_undo_s *)(list->items + list->count);
- obj_size = stmcb_size_rounded_up(bk_obj);
+ for (; undo < end; undo++) {
+ object_t *obj = undo->object;
+ char *dst = REAL_ADDRESS(pseg->pub.segment_base, obj);
- memcpy(REAL_ADDRESS(pseg->pub.segment_base, obj),
- bk_obj, obj_size);
- assert(obj->stm_flags & GCFLAG_WRITE_BARRIER); /* not written */
+ memcpy(dst + SLICE_OFFSET(undo->slice),
+ undo->backup,
+ SLICE_SIZE(undo->slice));
+ free(undo->backup);
+ }
- free(bk_obj);
- } TREE_LOOP_END;
+#ifndef NDEBUG
+ /* check that all objects have the GCFLAG_WRITE_BARRIER afterwards */
+ undo = (struct stm_undo_s *)list->items;
+ for (; undo < end; undo++) {
+ object_t *obj = undo->object;
+ char *dst = REAL_ADDRESS(pseg->pub.segment_base, obj);
+ assert(((struct object_s *)dst)->stm_flags & GCFLAG_WRITE_BARRIER);
+ }
+#endif
- tree_clear(tree);
+ list_clear(list);
- release_modified_objs_lock(segment_num);
+ //release_modified_objs_lock(segment_num);
#pragma pop_macro("STM_SEGMENT")
#pragma pop_macro("STM_PSEGMENT")
diff --git a/c8/stm/core.h b/c8/stm/core.h
--- a/c8/stm/core.h
+++ b/c8/stm/core.h
@@ -181,6 +181,7 @@
static inline void acquire_modified_objs_lock(int segnum)
{
+ /* XXX no longer neeeded? */
spinlock_acquire(get_priv_segment(segnum)->modified_objs_lock);
}
More information about the pypy-commit
mailing list