[pypy-commit] stmgc card-marking: first small optimisation to only copy if there are private pages involved
Raemi
noreply at buildbot.pypy.org
Thu May 22 11:37:12 CEST 2014
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: card-marking
Changeset: r1230:ddb7a7bc2c89
Date: 2014-05-22 11:38 +0200
http://bitbucket.org/pypy/stmgc/changeset/ddb7a7bc2c89/
Log: first small optimisation to only copy if there are private pages
involved
diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -489,6 +489,17 @@
}
}
+static inline bool _has_private_page_in_range(
+ long seg_num, uintptr_t start, uintptr_t size)
+{
+ uintptr_t first_page = start / 4096UL;
+ uintptr_t last_page = (start + size) / 4096UL;
+ for (; first_page <= last_page; first_page++)
+ if (is_private_page(seg_num, first_page))
+ return true;
+ return false;
+}
+
static void _card_wise_synchronize_object_now(object_t *obj)
{
assert(obj->stm_flags & GCFLAG_HAS_CARDS);
@@ -534,6 +545,9 @@
copy_size = obj_size - (start - (uintptr_t)obj);
}
+ /* since we have marked cards, at least one page here must be private */
+ assert(_has_private_page_in_range(myself, start, copy_size));
+
/* copy to shared segment: */
char *src = REAL_ADDRESS(STM_SEGMENT->segment_base, start);
char *dst = REAL_ADDRESS(stm_object_pages, start);
@@ -542,7 +556,8 @@
for (i = 1; i <= NB_SEGMENTS; i++) {
if (i == myself)
continue;
-
+ if (!_has_private_page_in_range(i, start, copy_size))
+ continue;
/* src = REAL_ADDRESS(stm_object_pages, start); */
dst = REAL_ADDRESS(get_segment_base(i), start);
memcpy(dst, src, copy_size);
More information about the pypy-commit
mailing list