summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Peterson <joshuap@unity3d.com>2020-05-18 09:39:39 +0300
committerIvan Maidanski <ivmai@mail.ru>2020-05-18 09:39:39 +0300
commit9b5e49f33cb84d555e94f85e42563d48177b797d (patch)
treeae97b6126b34820850657b883c2f107c7f242e53
parentb26e281bcac33444f523862b97f81e2a74bc2b4d (diff)
downloadbdwgc-9b5e49f33cb84d555e94f85e42563d48177b797d.tar.gz
New API function to clear GC exclusion table
(part of commit 8b95edbd6 from Unity-Technologies/bdwgc) * include/gc.h (GC_clear_exclusion_table): Declare new API function. * mark_rts.c (GC_clear_exclusion_table): Implement. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS] (main): Call GC_clear_exclusion_table.
-rw-r--r--include/gc.h3
-rw-r--r--mark_rts.c5
-rw-r--r--tests/test.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/include/gc.h b/include/gc.h
index 54d76962..fc04d90d 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -618,6 +618,9 @@ GC_API void GC_CALL GC_set_max_heap_size(GC_word /* n */);
GC_API void GC_CALL GC_exclude_static_roots(void * /* low_address */,
void * /* high_address_plus_1 */);
+/* Clear the number of entries in the exclusion table. Wizards only. */
+GC_API void GC_CALL GC_clear_exclusion_table(void);
+
/* Clear the set of root segments. Wizards only. */
GC_API void GC_CALL GC_clear_roots(void);
diff --git a/mark_rts.c b/mark_rts.c
index a3fd4181..edc806a0 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -534,6 +534,11 @@ struct exclusion GC_excl_table[MAX_EXCLUSIONS];
STATIC size_t GC_excl_table_entries = 0;/* Number of entries in use. */
+GC_API void GC_CALL GC_clear_exclusion_table(void)
+{
+ GC_excl_table_entries = 0;
+}
+
/* Return the first exclusion range that includes an address >= start_addr */
/* Assumes the exclusion table contains at least one entry (namely the */
/* GC data structures). */
diff --git a/tests/test.c b/tests/test.c
index d939961f..a348c06f 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1923,6 +1923,7 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
GC_noop1((GC_word)&Init);
# endif
n_tests = 0;
+ GC_clear_exclusion_table(); /* no-op as called before GC init */
# if defined(MACOS)
/* Make sure we have lots and lots of stack space. */
SetMinimumStack(cMinStackSpace);