Author: Remi Meier
Branch:
Changeset: r941:a31dc548b60b
Date: 2014-03-03 16:02 +0100
http://bitbucket.org/pypy/stmgc/changeset/a31dc548b60b/
Log: some comments and re-enable RESHARE_PAGES
diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -54,6 +54,7 @@
assert(get_priv_segment(other_segment_num)->write_lock_num ==
prev_owner);
contention_management(other_segment_num);
+ assert(get_priv_segment(other_segment_num)->pub.nursery_end ==
NSE_SIGABORT);
/* The rest of this code is for the case where we continue to
run. We have to signal the other thread to abort, and wait
diff --git a/c7/stm/gcpage.c b/c7/stm/gcpage.c
--- a/c7/stm/gcpage.c
+++ b/c7/stm/gcpage.c
@@ -258,10 +258,13 @@
char *ppage0 = get_segment_base(0) + i * 4096;
char *ppage1 = get_segment_base(1) + i * 4096;
- /* two cases... either the mapping is (0->0, 1->1) or (0->1,
- 1->0). Distinguish which case it is by hacking a lot */
+ /* two cases for mapping pages to file-pages (fpages):
+ - (0->0, 1->1)
+ - (0->1, 1->0)
+ Distinguish which case it is by hacking a lot */
// 0->0,1->1 or 0->1,1->0
+ /* map page 1 to fpage 0: */
d_remap_file_pages(ppage1, 4096, i);
// 0->0,1->0 or 0->1,1->0
@@ -273,8 +276,13 @@
char newvalue1 = *ppage1;
asm("":::"memory");
*ppage0 = oldvalue0;
+ /* if we are in 0->0,1->0, old and new are different:
+ In this case we are done. We keep the largemalloc
+ data structure and objects of ppage0/fpage0 */
if (oldvalue1 == newvalue1) {
// 0->1,1->0
+ /* ppage0/fpage1 has the data structure that we want
+ in ppage1/fpage0, so we copy it */
pagecopy(ppage1, ppage0); // copy from page0 to page1,
// i.e. from the underlying memory seg1 to seg0
d_remap_file_pages(ppage0, 4096, i);
@@ -339,7 +347,7 @@
/* first, if we're not seeing segment 0, we must change the
flags in flag_page_private[] from PRIVATE_PAGE to
- REMAPPING_PAGE, which will mean "can't re-share" */
+ SEGMENT1_PAGE, which will mean "can't re-share" */
if (segment_base != stm_object_pages && RESHARE_PAGES)
mark_flag_page_private(obj, segment_base);
diff --git a/c7/stm/gcpage.h b/c7/stm/gcpage.h
--- a/c7/stm/gcpage.h
+++ b/c7/stm/gcpage.h
@@ -15,7 +15,7 @@
#define GC_MAJOR_COLLECT 1.82
/* re-share pages after major collections (1 or 0) */
-#define RESHARE_PAGES 0
+#define RESHARE_PAGES 1
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -156,6 +156,7 @@
they use only one thread */
set_gs_register(get_segment_base(num));
#endif
+ dprintf(("acquired same segment: %d\n", num));
goto got_num;
}
/* Look for the next free segment. If there is none, wait for
@@ -165,6 +166,7 @@
num = (num + 1) % NB_SEGMENTS;
if (sync_ctl.in_use[num] == 0) {
/* we're getting 'num', a different number. */
+ dprintf(("acquired different segment: %d->%d\n",
tl->associated_segment_num, num));
tl->associated_segment_num = num;
set_gs_register(get_segment_base(num));
goto got_num;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit