lto-symtab.c (lto_cgraph_replace_node): Free decl_in_state.

* lto-symtab.c (lto_cgraph_replace_node): Free decl_in_state.
	* cgraph.c (cgraph_release_function_body): Free decl_in_state.
	* lto-section-in.c (lto_free_function_in_decl_state): New function.
	(lto_free_function_in_decl_state_for_node): New function.

	* lto.c (read_cgraph_and_symbols): Remove ggc_collect;
	clear section node; add comment why we do not collect.

From-SVN: r202093
This commit is contained in:
Jan Hubicka 2013-08-30 09:33:06 +02:00 committed by Jan Hubicka
parent 3f0fdc34ff
commit 256eefa9a9
5 changed files with 48 additions and 1 deletions

View File

@ -1663,6 +1663,8 @@ cgraph_release_function_body (struct cgraph_node *node)
if (!node->used_as_abstract_origin && DECL_INITIAL (node->symbol.decl))
DECL_INITIAL (node->symbol.decl) = error_mark_node;
release_function_body (node->symbol.decl);
if (node->symbol.lto_file_data)
lto_free_function_in_decl_state_for_node ((symtab_node) node);
}
/* Remove the node from cgraph. */
@ -3107,10 +3109,11 @@ cgraph_get_body (struct cgraph_node *node)
gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL);
lto_input_function_body (file_data, decl, data);
lto_input_function_body (file_data, node->symbol.decl, data);
lto_stats.num_function_bodies++;
lto_free_section_data (file_data, LTO_section_function_body, name,
data, len);
lto_free_function_in_decl_state_for_node ((symtab_node) node);
return true;
}

View File

@ -414,6 +414,41 @@ lto_get_function_in_decl_state (struct lto_file_decl_data *file_data,
return slot? ((struct lto_in_decl_state*) *slot) : NULL;
}
/* Free decl_states. */
void
lto_free_function_in_decl_state (struct lto_in_decl_state *state)
{
int i;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
ggc_free (state->streams[i].trees);
ggc_free (state);
}
/* Free decl_states associated with NODE. This makes it possible to furhter
release trees needed by the NODE's body. */
void
lto_free_function_in_decl_state_for_node (symtab_node node)
{
struct lto_in_decl_state temp;
void **slot;
if (!node->symbol.lto_file_data)
return;
temp.fn_decl = node->symbol.decl;
slot = htab_find_slot (node->symbol.lto_file_data->function_decl_states,
&temp, NO_INSERT);
if (slot && *slot)
{
lto_free_function_in_decl_state ((struct lto_in_decl_state*) *slot);
htab_clear_slot (node->symbol.lto_file_data->function_decl_states,
slot);
}
node->symbol.lto_file_data = NULL;
}
/* Report read pass end of the section. */

View File

@ -80,6 +80,8 @@ lto_cgraph_replace_node (struct cgraph_node *node,
/* Redirect incomming references. */
ipa_clone_referring ((symtab_node)prevailing_node, &node->symbol.ref_list);
lto_free_function_in_decl_state_for_node ((symtab_node)node);
if (node->symbol.decl != prevailing_node->symbol.decl)
cgraph_release_function_body (node);

View File

@ -1,3 +1,7 @@
2013-08-29 Jan Hubicka <jh@suse.cz>
* lto.c (read_cgraph_and_symbols): Free decl states.
2013-08-29 Jan Hubicka <jh@suse.cz>
* lto.c (compare_tree_sccs_1): Compare DECL_FINAL_P,

View File

@ -3502,6 +3502,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
gcc_assert (all_file_decl_data[i]->symtab_node_encoder);
lto_symtab_encoder_delete (all_file_decl_data[i]->symtab_node_encoder);
all_file_decl_data[i]->symtab_node_encoder = NULL;
lto_free_function_in_decl_state (all_file_decl_data[i]->global_decl_state);
all_file_decl_data[i]->global_decl_state = NULL;
all_file_decl_data[i]->current_decl_state = NULL;
}
/* Finally merge the cgraph according to the decl merging decisions. */