From 256eefa9a9497fae8dcc8bb96c8a28dd9c3e6dc8 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 30 Aug 2013 09:33:06 +0200 Subject: 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 --- gcc/lto-section-in.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'gcc/lto-section-in.c') diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c index 0ef421f..5821030 100644 --- a/gcc/lto-section-in.c +++ b/gcc/lto-section-in.c @@ -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. */ -- cgit v1.1