From 602fca427df6c5f7452677cfcdd16a5b9a3ca86a Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 17 Aug 2021 21:15:46 +0200 Subject: Turn 'bool force_collect' parameter to 'ggc_collect' into an 'enum ggc_collect mode' ... to make the meaning more explicit to the reader of the code. Follow-up to recent commit 0edf2e81bb02cba43b649b3f6e7258b68a779ac0 "Turn global 'ggc_force_collect' variable into 'force_collect' parameter to 'ggc_collect'". gcc/ * ggc.h (enum ggc_collect): New. (ggc_collect): Use it. * ggc-page.c: Adjust. * ggc-common.c: Likewise. * ggc-tests.c: Likewise. * read-rtl-function.c: Likewise. * selftest-run-tests.c: Likewise. * doc/gty.texi (Invoking the garbage collector): Likewise. Suggested-by: David Malcolm --- gcc/ggc-page.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/ggc-page.c') diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index a6fbeca..1c49643 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -2184,7 +2184,7 @@ validate_free_objects (void) /* Top level mark-and-sweep routine. */ void -ggc_collect (bool force_collect) +ggc_collect (enum ggc_collect mode) { /* Avoid frequent unnecessary work by skipping collection if the total allocations haven't expanded much since the last @@ -2196,7 +2196,8 @@ ggc_collect (bool force_collect) memory_block_pool::trim (); float min_expand = allocated_last_gc * param_ggc_min_expand / 100; - if (G.allocated < allocated_last_gc + min_expand && !force_collect) + if (mode == GGC_COLLECT_HEURISTIC + && G.allocated < allocated_last_gc + min_expand) return; timevar_push (TV_GC); -- cgit v1.1