https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70594

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Nathan Sidwell from comment #11)
> Patrick's original patch did 2 things AFAICT
> 1) make constexpr_call_table GC deletable
> 2) add the fundef_copies_table etc.
> 
> The failure we're observing is of constexpr_call_table losing information,
> which then causes the changing calls  of copy_fn.  Now, we'd still see that
> changing behaviour without #2.  But I don't think we get it without #1.  The
> logic in cxx_eval_call_expression is (pseudo code-ish):
> 
> entry = constexpr_call_table->find_or_insert (...)
> if (entry->value)
>   return entry->value
> 
> fn = get_fundef_copy (...)
> result = evaluate (...)
> entry->value = result;
> 
> return result;
> 
> Those are the only uses of the call_table and get_fundef_copy.
> 
> So restoring constexpr_call_table to non-deletableness is the safe patch. 
> We still get the fundef_copy improvement.

If you remove the deletableness, then I'd say it is really important to empty
the whole freelist at least at the end of parsing, so that when GIMPLE
optimizations and RTL optimizations run memory is not occupied by those
anymore.
And perhaps instead of GC use some LRU eviction from the freelist if there are
too many constexpr functions on the freelist (but it certainly shouldn't be
dependent on stuff like free memory or GC etc.), so that builds are
reproduceable.  There could be some --param with some sane defaults on how many
functions in freelist can be kept.

Reply via email to