diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-05-04 23:28:22 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-05-05 00:37:11 +0300 |
commit | 066a258133947bde0ae78d8816bdf4dd6bb913cc (patch) | |
tree | c441570034e1a9186bd20b9af2797a6884360252 /mark_rts.c | |
parent | c134bc41d2d8736222a35a50dd93a23d244f1151 (diff) | |
download | bdwgc-066a258133947bde0ae78d8816bdf4dd6bb913cc.tar.gz |
Do not rebuild_root_index unless remove_root_at_pos is called
* mark_rts.c [!MSWIN32 && !MSWINCE && !CYGWIN32] (GC_remove_tmp_roots,
GC_remove_roots_inner): Call GC_rebuild_root_index() only if
GC_remove_root_at_pos() is called at least once.
Diffstat (limited to 'mark_rts.c')
-rw-r--r-- | mark_rts.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -317,6 +317,9 @@ STATIC void GC_remove_root_at_pos(int i) STATIC void GC_remove_tmp_roots(void) { int i; +# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) + int old_n_roots = n_root_sets; +# endif for (i = 0; i < n_root_sets; ) { if (GC_static_roots[i].r_tmp) { @@ -326,7 +329,8 @@ STATIC void GC_remove_tmp_roots(void) } } # if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) - GC_rebuild_root_index(); + if (n_root_sets < old_n_roots) + GC_rebuild_root_index(); # endif } #endif @@ -352,15 +356,19 @@ STATIC void GC_remove_tmp_roots(void) STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e) { int i; + GC_bool rebuild = FALSE; + 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++; } } - GC_rebuild_root_index(); + if (rebuild) + GC_rebuild_root_index(); } #endif /* !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32) */ |