On Thu, Feb 13, 2025 at 12:48:44PM +0100, Richard Biener wrote:
> So what this basically does is ensure we mark DECL_VALUE_EXPR when
> VAR is marked which isn't done when marking a tree node.
> 
> That you special-case the hashtable walker is a workaround for
> us not being able to say
> 
> struct GTY((mark_extra_stuff)) tree_decl_with_vis {
> 
> on 'tree' (or specifically the structs for a VAR_DECL).  And that we
> rely on gengtype producing the 'tree' marker.  So we rely on the
> hashtable keeping referenced trees live.

Yes, we could just arrange for gt_ggc_mx_lang_tree_node to additionally
mark DECL_VALUE_EXPR for VAR_DECLs with DECL_HAS_VALUE_EXPR_P set (dunno how
exactly).
I think what the patch does should be slightly cheaper, we avoid those
DECL_VALUE_EXPR hash table lookups in the common case where DECL_VALUE_EXPR
of marked variables just refers to trees which reference only marked
VAR_DECLs and no unmarked ones.

        Jakub

Reply via email to