+2014-11-20 Trevor Saunders <tsaunders@mozilla.com>
+
+ * lto-section-in.c (lto_delete_in_decl_state): Adjust.
+ (lto_free_function_in_decl_state): Likewise.
+ * lto-streamer-out.c (copy_function_or_variable): Likewise.
+ * lto-streamer.h (lto_file_decl_data_get_ ## name): Likewise.
+ (lto_file_decl_data_num_ ## name ## s): Likewise.
+ (struct lto_tree_ref_table): Remove.
+ (struct lto_in_decl_state): Replace lto_tree_ref_table with vec<tree>.
+
2014-11-20 Trevor Saunders <tsaunders@mozilla.com>
* hash-map.h (hash_map::iterator): New class.
int i;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
- if (state->streams[i].trees)
- ggc_free (state->streams[i].trees);
+ vec_free (state->streams[i]);
ggc_free (state);
}
{
int i;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
- ggc_free (state->streams[i].trees);
+ vec_free (state->streams[i]);
ggc_free (state);
}
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{
- size_t n = in_state->streams[i].size;
- tree *trees = in_state->streams[i].trees;
+ size_t n = vec_safe_length (in_state->streams[i]);
+ vec<tree, va_gc> *trees = in_state->streams[i];
struct lto_tree_ref_encoder *encoder = &(out_state->streams[i]);
/* The out state must have the same indices and the in state.
gcc_assert (lto_tree_ref_encoder_size (encoder) == 0);
encoder->trees.reserve_exact (n);
for (j = 0; j < n; j++)
- encoder->trees.safe_push (trees[j]);
+ encoder->trees.safe_push ((*trees)[j]);
}
lto_free_section_data (file_data, LTO_section_function_body, name,
unsigned int idx) \
{ \
struct lto_in_decl_state *state = data->current_decl_state; \
- gcc_assert (idx < state->streams[LTO_DECL_STREAM_## UPPER_NAME].size); \
- return state->streams[LTO_DECL_STREAM_## UPPER_NAME].trees[idx]; \
+ return (*state->streams[LTO_DECL_STREAM_## UPPER_NAME])[idx]; \
} \
\
static inline unsigned int \
lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
{ \
struct lto_in_decl_state *state = data->current_decl_state; \
- return state->streams[LTO_DECL_STREAM_## UPPER_NAME].size; \
+ return vec_safe_length (state->streams[LTO_DECL_STREAM_## UPPER_NAME]); \
}
-
-/* Mapping from indices to trees. */
-struct GTY(()) lto_tree_ref_table
-{
- /* Array of referenced trees . */
- tree * GTY((length ("%h.size"))) trees;
-
- /* Size of array. */
- unsigned int size;
-};
-
-
/* The lto_tree_ref_encoder struct is used to encode trees into indices. */
struct lto_tree_ref_encoder
struct GTY(()) lto_in_decl_state
{
/* Array of lto_in_decl_buffers to store type and decls streams. */
- struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS];
+ vec<tree, va_gc> *streams[LTO_N_DECL_STREAMS];
/* If this in-decl state is associated with a function. FN_DECL
point to the FUNCTION_DECL. */
+2014-11-20 Trevor Saunders <tsaunders@mozilla.com>
+
+ * lto.c (lto_read_in_decl_state): Adjust.
+ (lto_fixup_state): Likewise.
+
2014-11-17 Jan Hubicka <hubicka@ucw.cz>
* lto.c (lto_read_decls): Do not rebuild DECL_FUNCTION_SPECIFIC_TARGET.
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{
uint32_t size = *data++;
- tree *decls = ggc_vec_alloc<tree> (size);
+ vec<tree, va_gc> *decls = NULL;
+ vec_alloc (decls, size);
for (j = 0; j < size; j++)
- decls[j] = streamer_tree_cache_get_tree (data_in->reader_cache, data[j]);
+ vec_safe_push (decls,
+ streamer_tree_cache_get_tree (data_in->reader_cache,
+ data[j]));
- state->streams[i].size = size;
- state->streams[i].trees = decls;
+ state->streams[i] = decls;
data += size;
}
lto_fixup_state (struct lto_in_decl_state *state)
{
unsigned i, si;
- struct lto_tree_ref_table *table;
/* Although we only want to replace FUNCTION_DECLs and VAR_DECLs,
we still need to walk from all DECLs to find the reachable
FUNCTION_DECLs and VAR_DECLs. */
for (si = 0; si < LTO_N_DECL_STREAMS; si++)
{
- table = &state->streams[si];
- for (i = 0; i < table->size; i++)
+ vec<tree, va_gc> *trees = state->streams[si];
+ for (i = 0; i < vec_safe_length (trees); i++)
{
- tree *tp = table->trees + i;
- if (VAR_OR_FUNCTION_DECL_P (*tp)
- && (TREE_PUBLIC (*tp) || DECL_EXTERNAL (*tp)))
- *tp = lto_symtab_prevailing_decl (*tp);
+ tree t = (*trees)[i];
+ if (VAR_OR_FUNCTION_DECL_P (t)
+ && (TREE_PUBLIC (t) || DECL_EXTERNAL (t)))
+ (*trees)[i] = lto_symtab_prevailing_decl (t);
}
}
}