[pypy-commit] stmgc c8-new-page-handling: fix overlap condition when trying to find objs that are partially in a page
Raemi
noreply at buildbot.pypy.org
Fri Sep 19 14:30:40 CEST 2014
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: c8-new-page-handling
Changeset: r1401:740a6aeff2eb
Date: 2014-09-19 14:30 +0200
http://bitbucket.org/pypy/stmgc/changeset/740a6aeff2eb/
Log: fix overlap condition when trying to find objs that are partially in
a page
diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -12,13 +12,11 @@
struct tree_s *tree = get_priv_segment(from_segnum)->modified_old_objects;
wlog_t *item;
TREE_LOOP_FORWARD(tree, item); {
- if (item->addr >= pagenum * 4096UL && item->addr < (pagenum + 1) * 4096UL) {
- object_t *obj = (object_t*)item->addr;
- struct object_s* bk_obj = (struct object_s *)item->val;
- size_t obj_size;
+ object_t *obj = (object_t*)item->addr;
+ struct object_s* bk_obj = (struct object_s *)item->val;
+ size_t obj_size = stmcb_size_rounded_up(bk_obj);
- obj_size = stmcb_size_rounded_up(bk_obj);
-
+ if (item->addr < (pagenum + 1) * 4096UL && item->addr + obj_size > pagenum * 4096UL) {
memcpy_to_accessible_pages(STM_SEGMENT->segment_num,
obj, (char*)bk_obj, obj_size);
@@ -91,6 +89,7 @@
/* make our page private */
page_privatize_in(STM_SEGMENT->segment_num, pagenum);
+ assert(get_page_status_in(my_segnum, pagenum) == PAGE_PRIVATE);
/* if there were modifications in the page, revert them: */
copy_bk_objs_from(shared_page_holder, pagenum);
@@ -362,6 +361,7 @@
struct object_s *bk_obj = malloc(obj_size);
memcpy(bk_obj, realobj, obj_size);
+ dprintf(("write_slowpath(%p): sz=%lu, bk=%p\n", obj, obj_size, bk_obj));
retry:
/* privatize pages: */
acquire_all_privatization_locks();
@@ -398,6 +398,7 @@
/* xxx: unmap? */
mprotect((char*)(get_virt_page_of(i, page) * 4096UL), 4096UL, PROT_NONE);
set_page_status_in(i, page, PAGE_NO_ACCESS);
+ dprintf(("NO_ACCESS in seg %d page %lu\n", i, page));
}
}
}
@@ -465,7 +466,7 @@
STM_PSEGMENT->shadowstack_at_start_of_transaction = tl->shadowstack;
enter_safe_point_if_requested();
- dprintf(("start_transaction\n"));
+ dprintf(("> start_transaction\n"));
s_mutex_unlock();
@@ -538,7 +539,7 @@
assert(STM_PSEGMENT->safe_point == SP_RUNNING);
assert(STM_PSEGMENT->running_pthread == pthread_self());
- dprintf(("stm_commit_transaction()\n"));
+ dprintf(("> stm_commit_transaction()\n"));
minor_collection(1);
_validate_and_add_to_commit_log();
diff --git a/c8/stm/pages.c b/c8/stm/pages.c
--- a/c8/stm/pages.c
+++ b/c8/stm/pages.c
@@ -84,6 +84,8 @@
char *dst_end = realobj + len;
uintptr_t loc_addr = (uintptr_t)dst_obj;
+ dprintf(("memcpy_to_accessible_pages(%d, %p, %p, %lu)\n", dst_segnum, dst_obj, src, len));
+
while (realobj != dst_end) {
if (get_page_status_in(dst_segnum, loc_addr / 4096UL) != PAGE_NO_ACCESS)
*realobj = *src;
More information about the pypy-commit
mailing list