summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/private/gc_priv.h3
-rw-r--r--mark.c17
-rw-r--r--os_dep.c2
3 files changed, 13 insertions, 9 deletions
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index a32ae428..bb8a949b 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -2671,7 +2671,8 @@ GC_EXTERN signed_word GC_bytes_found;
#if defined(MPROTECT_VDB) && defined(GWW_VDB)
GC_INNER GC_bool GC_gww_dirty_init(void);
/* Returns TRUE if GetWriteWatch is available. */
- /* May be called repeatedly. */
+ /* May be called repeatedly. May be called */
+ /* with or without the GC lock held. */
#endif
#if defined(CHECKSUMS) || defined(PROC_VDB)
diff --git a/mark.c b/mark.c
index 2027a0dd..861c06e0 100644
--- a/mark.c
+++ b/mark.c
@@ -1240,6 +1240,11 @@ GC_INNER void GC_help_marker(word my_mark_no)
/* May silently fail. */
static void alloc_mark_stack(size_t n)
{
+# ifdef GWW_VDB
+ static GC_bool GC_incremental_at_stack_alloc = FALSE;
+
+ GC_bool recycle_old;
+# endif
mse * new_stack;
GC_ASSERT(I_HOLD_LOCK());
@@ -1247,19 +1252,17 @@ static void alloc_mark_stack(size_t n)
# ifdef GWW_VDB
/* Don't recycle a stack segment obtained with the wrong flags. */
/* Win32 GetWriteWatch requires the right kind of memory. */
- static GC_bool GC_incremental_at_stack_alloc = FALSE;
- GC_bool recycle_old = !GC_auto_incremental
- || GC_incremental_at_stack_alloc;
-
+ recycle_old = !GC_auto_incremental || GC_incremental_at_stack_alloc;
GC_incremental_at_stack_alloc = GC_auto_incremental;
-# else
-# define recycle_old TRUE
# endif
GC_mark_stack_too_small = FALSE;
if (GC_mark_stack != NULL) {
if (new_stack != 0) {
- if (recycle_old) {
+# ifdef GWW_VDB
+ if (recycle_old)
+# endif
+ {
/* Recycle old space. */
GC_scratch_recycle_inner(GC_mark_stack,
GC_mark_stack_size * sizeof(struct GC_ms_entry));
diff --git a/os_dep.c b/os_dep.c
index 327a8256..efc96ff1 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -2977,7 +2977,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
GC_INNER GC_bool GC_gww_dirty_init(void)
{
- GC_ASSERT(I_HOLD_LOCK());
+ /* No assumption about the GC lock. */
detect_GetWriteWatch();
return GC_GWW_AVAILABLE();
}