On Tue, 2021-08-17 at 11:17 +0200, Thomas Schwinge wrote:
> Hi!
>
> On 2004-09-02T18:47:01+0200, Jan Hubicka <[email protected]> wrote:
> > *** ggc-common.c 9 Aug 2004 20:19:29 -0000 1.88
> > --- ggc-common.c 2 Sep 2004 16:08:50 -0000
>
> > + /* When set, ggc_collect will do collection. */
> > + bool ggc_force_collect;
>
> > *************** void dump_ggc_loc_statistics (void)
>
> > + ggc_force_collect = true;
> > + ggc_collect ();
>
> > *************** ggc_collect (void)
>
> > ! if (G.allocated < allocated_last_gc + min_expand)
>
> > ! if (G.allocated < allocated_last_gc + min_expand &&
> > !ggc_force_collect)
>
> > *** ggc.h 2 Sep 2004 02:39:15 -0000 1.68
> > --- ggc.h 2 Sep 2004 16:08:50 -0000
>
> > + /* When set, ggc_collect will do collection. */
> > + extern bool ggc_force_collect;
>
> This has later acquired another use in the GCC selftests.
>
> I wonder if we shouldn't simplify the interface per the attached
> "Turn
> global 'ggc_force_collect' variable into 'force_collect' parameter to
> 'ggc_collect'"? OK to push to master branch after bootstrap testing?
Looks good to me, but bool params can be unclear - maybe introduce an
enum to make the meaning more explicit to the reader of the code?
e.g.
enum gcc_collect_when
{
GGC_COLLECT_UNDER_MEMORY_PRESSURE,
GGC_COLLECT_ALWAYS
};
or somesuch???
Dave