summaryrefslogtreecommitdiff
path: root/mark.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-09-26 00:52:49 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-09-26 00:52:49 +0300
commitf487f27c72ab054e8f9101c0696c24836a18eb9b (patch)
tree1e414ec1b5512326aef8d0a4fdbe9b0970d73049 /mark.c
parentceef8a5a09692a09266eaa2f201f90a6456c62d0 (diff)
downloadbdwgc-f487f27c72ab054e8f9101c0696c24836a18eb9b.tar.gz
Do not disable parallel mark for WRAP_MARK_SOME
Issue #179 (bdwgc). Now, if there is a chance of unmapping of root segments, the latter ones are scanned immediately by GC_push_roots thus preventing memory protection faults in GC_mark_local. * include/private/gc_priv.h (GC_PUSH_CONDITIONAL): Move definition to mark_rts.c. * include/private/gcconfig.h [WRAP_MARK_SOME && PARALLEL_MARK] (PARALLEL_MARK): Do not undefine; remove TODO item. * mark.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): New internal function; add TODO item. * mark_rts.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_push_conditional_eager): Declare function. * mark_rts.c [WRAP_MARK_SOME && PARALLEL_MARK] (GC_PUSH_CONDITIONAL): Define to GC_push_conditional_eager if GC_parallel.
Diffstat (limited to 'mark.c')
-rw-r--r--mark.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/mark.c b/mark.c
index 28fea0e3..abdb9a2e 100644
--- a/mark.c
+++ b/mark.c
@@ -1628,6 +1628,35 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top)
# endif
}
+#if defined(WRAP_MARK_SOME) && defined(PARALLEL_MARK)
+ /* Similar to GC_push_conditional but scans the whole region immediately. */
+ GC_INNER void GC_push_conditional_eager(ptr_t bottom, ptr_t top,
+ GC_bool all)
+ GC_ATTR_NO_SANITIZE_ADDR GC_ATTR_NO_SANITIZE_MEMORY
+ {
+ word * b = (word *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
+ word * t = (word *)(((word) top) & ~(ALIGNMENT-1));
+ register word *p;
+ register word *lim;
+ register ptr_t greatest_ha = GC_greatest_plausible_heap_addr;
+ register ptr_t least_ha = GC_least_plausible_heap_addr;
+# define GC_greatest_plausible_heap_addr greatest_ha
+# define GC_least_plausible_heap_addr least_ha
+
+ if (top == NULL)
+ return;
+ (void)all; /* TODO: If !all then scan only dirty pages. */
+
+ lim = t - 1;
+ for (p = b; (word)p <= (word)lim; p = (word *)((ptr_t)p + ALIGNMENT)) {
+ register word q = *p;
+ GC_PUSH_ONE_HEAP(q, p, GC_mark_stack_top);
+ }
+# undef GC_greatest_plausible_heap_addr
+# undef GC_least_plausible_heap_addr
+ }
+#endif /* WRAP_MARK_SOME && PARALLEL_MARK */
+
#if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES) && \
defined(MARK_BIT_PER_GRANULE)
# if GC_GRANULE_WORDS == 1