From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10490 invoked by alias); 20 Jun 2014 10:57:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 10477 invoked by uid 89); 20 Jun 2014 10:57:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.mozilla.org Received: from mx1.corp.phx1.mozilla.com (HELO smtp.mozilla.org) (63.245.216.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 20 Jun 2014 10:57:34 +0000 Received: from tsaunders-iceball.corp.tor1.mozilla.com (69-165-234-187.cable.teksavvy.com [69.165.234.187]) (Authenticated sender: tsaunders@mozilla.com) by mx1.mail.corp.phx1.mozilla.com (Postfix) with ESMTPSA id B7785F2E16; Fri, 20 Jun 2014 03:57:31 -0700 (PDT) Date: Fri, 20 Jun 2014 10:57:00 -0000 From: Trevor Saunders To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org Subject: Re: Move DECL_INIT_PRIORITY/FINI_PRIORITY to symbol table Message-ID: <20140620105709.GA340@tsaunders-iceball.corp.tor1.mozilla.com> References: <20140620064122.GA9003@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20140620064122.GA9003@kam.mff.cuni.cz> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg01601.txt.bz2 On Fri, Jun 20, 2014 at 08:41:22AM +0200, Jan Hubicka wrote: > Hi, > this patch moves init and fini priorities to symbol table instead of tree= s. > They are already in on-side hashtables, but the hashtables are now mainta= ned > by symbol table. This is needed for correctness with LTO. >=20 > Currently tree merging may load declaration with priority and then ggc_fr= ee > it creating a stale entry in the hashtable. This is usually not problem,= because > ctor declarations are usually static, but it is not safe. >=20 > I would really like to have template for such a sparse annotations to sym= bols > (writting our old school pch friendly hashtable is not a fun) but I am no= t sure > I can get it done in GGC/PCH safe way. Is user marking working for PCH? hm, so thinking about this a little more I wonder if you can just use hash_table, and add a dtor to symtab_node that removes its entry from the hash table. ggc should invoke your dtor as a finalizer for the node then. Trev >=20 > Bootstrapped/regtested x86_64-linux, will commit it shortly. >=20 > Honza >=20 > * cgraph.h (struct symtab_node): Add field in_init_priority_hash > (set_init_priority, get_init_priority, set_fini_priority, > get_fini_priority): New methods. > * tree.c (init_priority_for_decl): Remove. > (init_ttree): Do not initialize init priority. > (decl_init_priority_lookup, decl_fini_priority_lookup): Rewrite. > (decl_priority_info): Remove. > (decl_init_priority_insert): Rewrite. > (decl_fini_priority_insert): Rewrite. > * tree.h (tree_priority_map_eq, tree_priority_map_hash, > tree_priority_map_marked_p): Remove. > * lto-cgraph.c (lto_output_node, input_node): Stream init priorities. > * lto-streamer-out.c (hash_tree): Do not hash priorities. > * tree-streamer-out.c (pack_ts_decl_with_vis_value_fields): Do > not output priorities. > (pack_ts_function_decl_value_fields): Likewise. > * tree-streamer-in.c (unpack_ts_decl_with_vis_value_fields): Do > not input priorities. > (unpack_ts_function_decl_value_fields): Likewise. > * symtab.c (symbol_priority_map): Declare. > (init_priority_hash): Declare. > (symtab_unregister_node): Unregister from priority hash, too. > (symtab_node::get_init_priority, cgraph_node::get_fini_priority): > New methods. > (symbol_priority_map_eq, symbol_priority_map_hash): New functions. > (symbol_priority_info): New function. > (symtab_node::set_init_priority, cgraph_node::set_fini_priority): > New methods. > * tree-core.h (tree_priority_map): Remove. >=20 > * lto.c (compare_tree_sccs_1): Do not compare priorities. > Index: cgraph.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cgraph.h (revision 211831) > +++ cgraph.h (working copy) > @@ -130,6 +130,8 @@ public: >=20=20 > /* Set when symbol has address taken. */ > unsigned address_taken : 1; > + /* Set when init priority is set. */ > + unsigned in_init_priority_hash : 1; >=20=20 >=20=20 > /* Ordering of all symtab entries. */ > @@ -163,6 +165,7 @@ public: > return x_comdat_group; > } >=20=20 > + /* Return comdat group as identifier_node. */ > tree get_comdat_group_id () > { > if (x_comdat_group && TREE_CODE (x_comdat_group) !=3D IDENTIFIER_N= ODE) > @@ -208,6 +211,9 @@ public: > /* Set section for symbol and its aliases. */ > void set_section (const char *section); > void set_section_for_node (const char *section); > + > + void set_init_priority (priority_type priority); > + priority_type get_init_priority (); > }; >=20=20 > enum availability > @@ -497,6 +503,9 @@ public: > /* True if this decl calls a COMDAT-local function. This is set up in > compute_inline_parameters and inline_call. */ > unsigned calls_comdat_local : 1; > + > + void set_fini_priority (priority_type priority); > + priority_type get_fini_priority (); > }; >=20=20 >=20=20 > Index: tree.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree.c (revision 211831) > +++ tree.c (working copy) > @@ -219,10 +219,6 @@ static GTY ((if_marked ("tree_decl_map_m > static GTY ((if_marked ("tree_vec_map_marked_p"), param_is (struct tree_= vec_map))) > htab_t debug_args_for_decl; >=20=20 > -static GTY ((if_marked ("tree_priority_map_marked_p"), > - param_is (struct tree_priority_map))) > - htab_t init_priority_for_decl; > - > static void set_type_quals (tree, int); > static int type_hash_eq (const void *, const void *); > static hashval_t type_hash_hash (const void *); > @@ -573,8 +569,6 @@ init_ttree (void) >=20=20 > value_expr_for_decl =3D htab_create_ggc (512, tree_decl_map_hash, > tree_decl_map_eq, 0); > - init_priority_for_decl =3D htab_create_ggc (512, tree_priority_map_has= h, > - tree_priority_map_eq, 0); >=20=20 > int_cst_hash_table =3D htab_create_ggc (1024, int_cst_hash_hash, > int_cst_hash_eq, NULL); > @@ -6492,13 +6486,12 @@ tree_decl_map_hash (const void *item) > priority_type > decl_init_priority_lookup (tree decl) > { > - struct tree_priority_map *h; > - struct tree_map_base in; > + symtab_node *snode =3D symtab_get_node (decl); >=20=20 > - gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); > - in.from =3D decl; > - h =3D (struct tree_priority_map *) htab_find (init_priority_for_decl, = &in); > - return h ? h->init : DEFAULT_INIT_PRIORITY; > + if (!snode) > + return DEFAULT_INIT_PRIORITY; > + return > + snode->get_init_priority (); > } >=20=20 > /* Return the finalization priority for DECL. */ > @@ -6506,39 +6499,12 @@ decl_init_priority_lookup (tree decl) > priority_type > decl_fini_priority_lookup (tree decl) > { > - struct tree_priority_map *h; > - struct tree_map_base in; > - > - gcc_assert (TREE_CODE (decl) =3D=3D FUNCTION_DECL); > - in.from =3D decl; > - h =3D (struct tree_priority_map *) htab_find (init_priority_for_decl, = &in); > - return h ? h->fini : DEFAULT_INIT_PRIORITY; > -} > - > -/* Return the initialization and finalization priority information for > - DECL. If there is no previous priority information, a freshly > - allocated structure is returned. */ > - > -static struct tree_priority_map * > -decl_priority_info (tree decl) > -{ > - struct tree_priority_map in; > - struct tree_priority_map *h; > - void **loc; > - > - in.base.from =3D decl; > - loc =3D htab_find_slot (init_priority_for_decl, &in, INSERT); > - h =3D (struct tree_priority_map *) *loc; > - if (!h) > - { > - h =3D ggc_cleared_alloc (); > - *loc =3D h; > - h->base.from =3D decl; > - h->init =3D DEFAULT_INIT_PRIORITY; > - h->fini =3D DEFAULT_INIT_PRIORITY; > - } > + cgraph_node *node =3D cgraph_get_node (decl); >=20=20 > - return h; > + if (!node) > + return DEFAULT_INIT_PRIORITY; > + return > + node->get_fini_priority (); > } >=20=20 > /* Set the initialization priority for DECL to PRIORITY. */ > @@ -6546,13 +6512,19 @@ decl_priority_info (tree decl) > void > decl_init_priority_insert (tree decl, priority_type priority) > { > - struct tree_priority_map *h; > + struct symtab_node *snode; >=20=20 > - gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); > if (priority =3D=3D DEFAULT_INIT_PRIORITY) > - return; > - h =3D decl_priority_info (decl); > - h->init =3D priority; > + { > + snode =3D symtab_get_node (decl); > + if (!snode) > + return; > + } > + else if (TREE_CODE (decl) =3D=3D VAR_DECL) > + snode =3D varpool_node_for_decl (decl); > + else > + snode =3D cgraph_get_create_node (decl); > + snode->set_init_priority (priority); > } >=20=20 > /* Set the finalization priority for DECL to PRIORITY. */ > @@ -6560,13 +6532,17 @@ decl_init_priority_insert (tree decl, pr > void > decl_fini_priority_insert (tree decl, priority_type priority) > { > - struct tree_priority_map *h; > + struct cgraph_node *node; >=20=20 > - gcc_assert (TREE_CODE (decl) =3D=3D FUNCTION_DECL); > if (priority =3D=3D DEFAULT_INIT_PRIORITY) > - return; > - h =3D decl_priority_info (decl); > - h->fini =3D priority; > + { > + node =3D cgraph_get_node (decl); > + if (!node) > + return; > + } > + else > + node =3D cgraph_get_create_node (decl); > + node->set_fini_priority (priority); > } >=20=20 > /* Print out the statistics for the DECL_DEBUG_EXPR hash table. */ > Index: tree.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree.h (revision 211831) > +++ tree.h (working copy) > @@ -4345,10 +4345,6 @@ extern unsigned int tree_decl_map_hash ( > #define tree_int_map_hash tree_map_base_hash > #define tree_int_map_marked_p tree_map_base_marked_p >=20=20 > -#define tree_priority_map_eq tree_map_base_eq > -#define tree_priority_map_hash tree_map_base_hash > -#define tree_priority_map_marked_p tree_map_base_marked_p > - > #define tree_vec_map_eq tree_map_base_eq > #define tree_vec_map_hash tree_decl_map_hash > #define tree_vec_map_marked_p tree_map_base_marked_p > Index: lto-cgraph.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- lto-cgraph.c (revision 211831) > +++ lto-cgraph.c (working copy) > @@ -557,6 +557,10 @@ lto_output_node (struct lto_simple_outpu > streamer_write_uhwi_stream (ob->main_stream, node->thunk.virtual_v= alue); > } > streamer_write_hwi_stream (ob->main_stream, node->profile_id); > + if (DECL_STATIC_CONSTRUCTOR (node->decl)) > + streamer_write_hwi_stream (ob->main_stream, DECL_INIT_PRIORITY (node= ->decl)); > + if (DECL_STATIC_DESTRUCTOR (node->decl)) > + streamer_write_hwi_stream (ob->main_stream, DECL_FINI_PRIORITY (node= ->decl)); > } >=20=20 > /* Output the varpool NODE to OB.=20 > @@ -1210,6 +1214,10 @@ input_node (struct lto_file_decl_data *f > if (node->alias && !node->analyzed && node->weakref) > node->alias_target =3D get_alias_symbol (node->decl); > node->profile_id =3D streamer_read_hwi (ib); > + if (DECL_STATIC_CONSTRUCTOR (node->decl)) > + SET_DECL_INIT_PRIORITY (node->decl, streamer_read_hwi (ib)); > + if (DECL_STATIC_DESTRUCTOR (node->decl)) > + SET_DECL_FINI_PRIORITY (node->decl, streamer_read_hwi (ib)); > return node; > } >=20=20 > Index: lto-streamer-out.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- lto-streamer-out.c (revision 211831) > +++ lto-streamer-out.c (working copy) > @@ -827,8 +827,6 @@ hash_tree (struct streamer_tree_cache_d > | (DECL_CXX_CONSTRUCTOR_P (t) << 1) > | (DECL_CXX_DESTRUCTOR_P (t) << 2), > v); > - if (VAR_OR_FUNCTION_DECL_P (t)) > - v =3D iterative_hash_host_wide_int (DECL_INIT_PRIORITY (t), v); > } >=20=20 > if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) > @@ -852,8 +850,6 @@ hash_tree (struct streamer_tree_cache_d > | (DECL_LOOPING_CONST_OR_PURE_P (t) << 15), v); > if (DECL_BUILT_IN_CLASS (t) !=3D NOT_BUILT_IN) > v =3D iterative_hash_host_wide_int (DECL_FUNCTION_CODE (t), v); > - if (DECL_STATIC_DESTRUCTOR (t)) > - v =3D iterative_hash_host_wide_int (DECL_FINI_PRIORITY (t), v); > } >=20=20 > if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) > Index: lto/lto.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- lto/lto.c (revision 211831) > +++ lto/lto.c (working copy) > @@ -1300,8 +1300,6 @@ compare_tree_sccs_1 (tree t1, tree t2, t > /* DECL_IN_TEXT_SECTION is set during final asm output only. = */ > compare_values (DECL_IN_CONSTANT_POOL); > } > - if (VAR_OR_FUNCTION_DECL_P (t1)) > - compare_values (DECL_INIT_PRIORITY); > } >=20=20 > if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) > @@ -1328,8 +1326,6 @@ compare_tree_sccs_1 (tree t1, tree t2, t > compare_values (DECL_CXX_DESTRUCTOR_P); > if (DECL_BUILT_IN_CLASS (t1) !=3D NOT_BUILT_IN) > compare_values (DECL_FUNCTION_CODE); > - if (DECL_STATIC_DESTRUCTOR (t1)) > - compare_values (DECL_FINI_PRIORITY); > } >=20=20 > if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) > Index: tree-streamer-out.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree-streamer-out.c (revision 211831) > +++ tree-streamer-out.c (working copy) > @@ -256,8 +256,6 @@ pack_ts_decl_with_vis_value_fields (stru > bp_pack_value (bp, DECL_CXX_CONSTRUCTOR_P (expr), 1); > bp_pack_value (bp, DECL_CXX_DESTRUCTOR_P (expr), 1); > } > - if (VAR_OR_FUNCTION_DECL_P (expr)) > - bp_pack_var_len_unsigned (bp, DECL_INIT_PRIORITY (expr)); > } >=20=20 >=20=20 > @@ -291,8 +289,6 @@ pack_ts_function_decl_value_fields (stru > bp_pack_value (bp, DECL_LOOPING_CONST_OR_PURE_P (expr), 1); > if (DECL_BUILT_IN_CLASS (expr) !=3D NOT_BUILT_IN) > bp_pack_value (bp, DECL_FUNCTION_CODE (expr), 11); > - if (DECL_STATIC_DESTRUCTOR (expr)) > - bp_pack_var_len_unsigned (bp, DECL_FINI_PRIORITY (expr)); > } >=20=20 >=20=20 > Index: tree-streamer-in.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree-streamer-in.c (revision 211831) > +++ tree-streamer-in.c (working copy) > @@ -288,12 +288,6 @@ unpack_ts_decl_with_vis_value_fields (st > DECL_CXX_CONSTRUCTOR_P (expr) =3D (unsigned) bp_unpack_value (bp, = 1); > DECL_CXX_DESTRUCTOR_P (expr) =3D (unsigned) bp_unpack_value (bp, 1= ); > } > - if (VAR_OR_FUNCTION_DECL_P (expr)) > - { > - priority_type p; > - p =3D (priority_type) bp_unpack_var_len_unsigned (bp); > - SET_DECL_INIT_PRIORITY (expr, p); > - } > } >=20=20 >=20=20 > @@ -336,12 +330,6 @@ unpack_ts_function_decl_value_fields (st > fatal_error ("target specific builtin not available"); > } > } > - if (DECL_STATIC_DESTRUCTOR (expr)) > - { > - priority_type p; > - p =3D (priority_type) bp_unpack_var_len_unsigned (bp); > - SET_DECL_FINI_PRIORITY (expr, p); > - } > } >=20=20 >=20=20 > Index: symtab.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- symtab.c (revision 211831) > +++ symtab.c (working copy) > @@ -64,6 +64,17 @@ static GTY((param_is (section_hash_entry > /* Hash table used to convert assembler names into nodes. */ > static GTY((param_is (symtab_node))) htab_t assembler_name_hash; >=20=20 > +/* Map from a symbol to initialization/finalization priorities. */ > +struct GTY(()) symbol_priority_map { > + symtab_node *symbol; > + priority_type init; > + priority_type fini; > +}; > + > +/* Hash table used to hold init priorities. */ > +static GTY ((param_is (struct symbol_priority_map))) > + htab_t init_priority_hash; > + > /* Linked list of symbol table nodes. */ > symtab_node *symtab_nodes; >=20=20 > @@ -337,6 +348,16 @@ symtab_unregister_node (symtab_node *nod > } > if (!is_a (node) || !DECL_HARD_REGISTER (node->decl)) > unlink_from_assembler_name_hash (node, false); > + if (node->in_init_priority_hash) > + { > + struct symbol_priority_map in; > + void **slot; > + in.symbol =3D node; > + > + slot =3D htab_find_slot (init_priority_hash, &in, NO_INSERT); > + if (slot) > + htab_clear_slot (init_priority_hash, slot); > + } > } >=20=20 >=20=20 > @@ -1176,6 +1197,122 @@ symtab_node::set_section (const char *se > symtab_for_node_and_aliases (this, set_section_1, const_cast(s= ection), true); > } >=20=20 > +/* Return the initialization priority. */ > + > +priority_type > +symtab_node::get_init_priority () > +{ > + struct symbol_priority_map *h; > + struct symbol_priority_map in; > + > + if (!this->in_init_priority_hash) > + return DEFAULT_INIT_PRIORITY; > + in.symbol =3D this; > + h =3D (struct symbol_priority_map *) htab_find (init_priority_hash, &i= n); > + return h ? h->init : DEFAULT_INIT_PRIORITY; > +} > + > +/* Return the finalization priority. */ > + > +priority_type > +cgraph_node::get_fini_priority () > +{ > + struct symbol_priority_map *h; > + struct symbol_priority_map in; > + > + if (!this->in_init_priority_hash) > + return DEFAULT_INIT_PRIORITY; > + in.symbol =3D this; > + h =3D (struct symbol_priority_map *) htab_find (init_priority_hash, &i= n); > + return h ? h->fini : DEFAULT_INIT_PRIORITY; > +} > + > +/* Return true if the from tree in both priority maps are equal. */ > + > +int > +symbol_priority_map_eq (const void *va, const void *vb) > +{ > + const struct symbol_priority_map *const a =3D (const struct symbol_pri= ority_map *) va, > + *const b =3D (const struct symbol_priority_map *) vb; > + return (a->symbol =3D=3D b->symbol); > +} > + > +/* Hash a from symbol in a symbol_priority_map. */ > + > +unsigned int > +symbol_priority_map_hash (const void *item) > +{ > + return htab_hash_pointer (((const struct symbol_priority_map *)item)->= symbol); > +} > + > +/* Return the initialization and finalization priority information for > + DECL. If there is no previous priority information, a freshly > + allocated structure is returned. */ > + > +static struct symbol_priority_map * > +symbol_priority_info (struct symtab_node *symbol) > +{ > + struct symbol_priority_map in; > + struct symbol_priority_map *h; > + void **loc; > + > + in.symbol =3D symbol; > + if (!init_priority_hash) > + init_priority_hash =3D htab_create_ggc (512, symbol_priority_map_has= h, > + symbol_priority_map_eq, 0); > + > + loc =3D htab_find_slot (init_priority_hash, &in, INSERT); > + h =3D (struct symbol_priority_map *) *loc; > + if (!h) > + { > + h =3D ggc_cleared_alloc (); > + *loc =3D h; > + h->symbol =3D symbol; > + h->init =3D DEFAULT_INIT_PRIORITY; > + h->fini =3D DEFAULT_INIT_PRIORITY; > + symbol->in_init_priority_hash =3D true; > + } > + > + return h; > +} > + > +/* Set initialization priority to PRIORITY. */ > + > +void > +symtab_node::set_init_priority (priority_type priority) > +{ > + struct symbol_priority_map *h; > + > + if (is_a (this)) > + gcc_assert (DECL_STATIC_CONSTRUCTOR (this->decl)); > + > + if (priority =3D=3D DEFAULT_INIT_PRIORITY) > + { > + gcc_assert (get_init_priority() =3D=3D priority); > + return; > + } > + h =3D symbol_priority_info (this); > + h->init =3D priority; > +} > + > +/* Set fialization priority to PRIORITY. */ > + > +void > +cgraph_node::set_fini_priority (priority_type priority) > +{ > + struct symbol_priority_map *h; > + > + gcc_assert (DECL_STATIC_DESTRUCTOR (this->decl)); > + > + if (priority =3D=3D DEFAULT_INIT_PRIORITY) > + { > + gcc_assert (get_fini_priority() =3D=3D priority); > + return; > + } > + h =3D symbol_priority_info (this); > + h->fini =3D priority; > +} > + > /* Worker for symtab_resolve_alias. */ >=20=20 > static bool > Index: tree-core.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- tree-core.h (revision 211831) > +++ tree-core.h (working copy) > @@ -1761,13 +1761,6 @@ struct GTY(()) tree_int_map { > unsigned int to; > }; >=20=20 > -/* Map from a tree to initialization/finalization priorities. */ > -struct GTY(()) tree_priority_map { > - struct tree_map_base base; > - priority_type init; > - priority_type fini; > -}; > - > /* Map from a decl tree to a tree vector. */ > struct GTY(()) tree_vec_map { > struct tree_map_base base;