diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-04 23:21:38 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-05-04 23:21:53 +0300 |
commit | 000f4575cec2b8614fe254bc8e3dd2bbc1e7c6a9 (patch) | |
tree | 6fb0bc493b210aa8e88527484f71165678469005 /mark_rts.c | |
parent | 641ba54572691104a8f49b10498c6e905128123b (diff) | |
download | bdwgc-000f4575cec2b8614fe254bc8e3dd2bbc1e7c6a9.tar.gz |
Support GC_remove_roots on Win32
* include/gc/gc.h (GC_add_roots, GC_remove_roots): Refine comment.
* include/gc/gc.h (GC_remove_roots): Remove comment that it may be
unimplemented on some platforms.
* mark_rts.c (GC_remove_roots_inner, GC_remove_roots): Define
unconditionally.
* mark_rts.c [!MSWIN32 && !MSWINCE && !CYGWIN32]
(GC_remove_roots_inner): Replace rebuild local variable with
old_n_roots.
Diffstat (limited to 'mark_rts.c')
-rw-r--r-- | mark_rts.c | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -338,11 +338,10 @@ STATIC void GC_remove_tmp_roots(void) } #endif -#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) - STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e); +STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e); - GC_API void GC_CALL GC_remove_roots(void *b, void *e) - { +GC_API void GC_CALL GC_remove_roots(void *b, void *e) +{ DCL_LOCK_STATE; /* Quick check whether has nothing to do */ @@ -353,27 +352,29 @@ STATIC void GC_remove_tmp_roots(void) LOCK(); GC_remove_roots_inner((ptr_t)b, (ptr_t)e); UNLOCK(); - } +} - /* Should only be called when the lock is held */ - STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e) - { +/* Should only be called when the lock is held */ +STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e) +{ int i; - GC_bool rebuild = FALSE; +# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) + int old_n_roots = n_root_sets; +# endif for (i = 0; i < n_root_sets; ) { if ((word)GC_static_roots[i].r_start >= (word)b && (word)GC_static_roots[i].r_end <= (word)e) { GC_remove_root_at_pos(i); - rebuild = TRUE; } else { i++; } } - if (rebuild) +# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) + if (n_root_sets < old_n_roots) GC_rebuild_root_index(); - } -#endif /* !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) */ +# endif +} #ifdef USE_PROC_FOR_LIBRARIES /* Exchange the elements of the roots table. Requires rebuild of */ |