diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 49 | ||||
-rw-r--r-- | gcc/cp/class.c | 5 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 2 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 8 | ||||
-rw-r--r-- | gcc/cp/lex.c | 11 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 14 | ||||
-rw-r--r-- | gcc/cp/parser.c | 18 | ||||
-rw-r--r-- | gcc/cp/pt.c | 10 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 2 |
10 files changed, 88 insertions, 39 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf6833664cf..931cbe141eb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,52 @@ +2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com> + + * typeck2.c (abstract_virtuals_error): Use typed GC allocation. + + * pt.c (maybe_process_partial_specialization): Likewise. + (register_specialization): Likewise. + (add_pending_template): Likewise. + (lookup_template_class): Likewise. + (push_tinst_level): Likewise. + + * parser.c (cp_lexer_new_main): Likewise. + (cp_lexer_new_from_tokens): Likewise. + (cp_token_cache_new): Likewise. + (cp_parser_context_new): Likewise. + (cp_parser_new): Likewise. + (cp_parser_nested_name_specifier_opt): Likewise. + (cp_parser_template_id): Likewise. + + * name-lookup.c (binding_entry_make): Likewise. + (binding_table_construct): Likewise. + (binding_table_new): Likewise. + (cxx_binding_make): Likewise. + (pushdecl_maybe_friend): Likewise. + (begin_scope): Likewise. + (push_to_top_level): Likewise. + + * lex.c (init_reswords): Likewise. + (retrofit_lang_decl): Likewise. + (cxx_dup_lang_specific_decl): Likewise. + (copy_lang_type): Likewise. + (cxx_make_type): Likewise. + + * decl.c (make_label_decl): Likewise. + (check_goto): Likewise. + (start_preparsed_function): Likewise. + (save_function_data): Likewise. + + * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. + + * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. + + * class.c (finish_struct_1): Likewise. + + * cp-tree.h (struct lang_type): Add variable_size GTY option. + (struct lang_decl): Likewise. + + * parser.c (cp_parser_new): Update comment to not reference + ggc_alloc. + 2010-06-07 Jason Merrill <jason@redhat.com> PR c++/44366 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c6da4cd28bb..14224aa694d 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5437,9 +5437,8 @@ finish_struct_1 (tree t) n_fields = count_fields (TYPE_FIELDS (t)); if (n_fields > 7) { - struct sorted_fields_type *field_vec = GGC_NEWVAR - (struct sorted_fields_type, - sizeof (struct sorted_fields_type) + n_fields * sizeof (tree)); + struct sorted_fields_type *field_vec = ggc_alloc_sorted_fields_type + (sizeof (struct sorted_fields_type) + n_fields * sizeof (tree)); field_vec->len = n_fields; add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0); qsort (field_vec->elts, n_fields, sizeof (tree), diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 63ce56b3c30..9cfe7702aca 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -203,7 +203,7 @@ decl_shadowed_for_var_insert (tree from, tree to) struct tree_decl_map *h; void **loc; - h = GGC_NEW (struct tree_decl_map); + h = ggc_alloc_tree_decl_map (); h->base.from = from; h->to = to; loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, DECL_UID (from), diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f507a21a78d..eaf34591cc9 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1333,7 +1333,7 @@ struct GTY(()) lang_type_ptrmem { tree record; }; -struct GTY(()) lang_type { +struct GTY((variable_size)) lang_type { union lang_type_u { struct lang_type_header GTY((skip (""))) h; @@ -1884,7 +1884,7 @@ struct GTY(()) lang_decl_parm { union rather than a struct containing a union as its only field, but tree.h declares it as a struct. */ -struct GTY(()) lang_decl { +struct GTY((variable_size)) lang_decl { union GTY((desc ("%h.base.selector"))) lang_decl_u { struct lang_decl_base GTY ((default)) base; struct lang_decl_min GTY((tag ("0"))) min; @@ -3271,8 +3271,8 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) do { \ if (TYPE_LANG_SPECIFIC (NODE) == NULL) \ { \ - TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \ - (struct lang_type, sizeof (struct lang_type_ptrmem)); \ + TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_cleared_lang_type \ + (sizeof (struct lang_type_ptrmem)); \ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \ } \ TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 171e160b2af..706eee9b666 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -2449,7 +2449,7 @@ make_label_decl (tree id, int local_p) /* Record this label on the list of labels used in this function. We do this before calling make_label_decl so that we get the IDENTIFIER_LABEL_VALUE before the new label is declared. */ - ent = GGC_CNEW (struct named_label_entry); + ent = ggc_alloc_cleared_named_label_entry (); ent->label_decl = decl; slot = htab_find_slot (named_labels, ent, INSERT); @@ -2669,7 +2669,7 @@ check_goto (tree decl) && ent->uses->names_in_scope == current_binding_level->names) return; - new_use = GGC_NEW (struct named_label_use_entry); + new_use = ggc_alloc_named_label_use_entry (); new_use->binding_level = current_binding_level; new_use->names_in_scope = current_binding_level->names; new_use->o_goto_locus = input_location; @@ -12016,7 +12016,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags) /* Initialize the language data structures. Whenever we start a new function, we destroy temporaries in the usual way. */ - cfun->language = GGC_CNEW (struct language_function); + cfun->language = ggc_alloc_cleared_language_function (); current_stmt_tree ()->stmts_are_full_exprs_p = 1; current_binding_level = bl; @@ -12317,7 +12317,7 @@ save_function_data (tree decl) gcc_assert (!DECL_PENDING_INLINE_P (decl)); /* Make a copy. */ - f = GGC_NEW (struct language_function); + f = ggc_alloc_language_function (); memcpy (f, cp_function_chain, sizeof (struct language_function)); DECL_SAVED_FUNCTION_DATA (decl) = f; diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 1bae86fd692..9e3b57b75ef 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -184,7 +184,7 @@ init_reswords (void) /* The Objective-C keywords are all context-dependent. */ mask |= D_OBJC; - ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX); + ridpointers = ggc_alloc_cleared_vec_tree ((int) RID_MAX); for (i = 0; i < num_c_common_reswords; i++) { if (c_common_reswords[i].disable & D_CONLY) @@ -540,7 +540,7 @@ retrofit_lang_decl (tree t) else gcc_unreachable (); - ld = GGC_CNEWVAR (struct lang_decl, size); + ld = ggc_alloc_cleared_lang_decl (size); ld->u.base.selector = sel; @@ -581,7 +581,7 @@ cxx_dup_lang_specific_decl (tree node) else gcc_unreachable (); - ld = GGC_NEWVAR (struct lang_decl, size); + ld = ggc_alloc_lang_decl (size); memcpy (ld, DECL_LANG_SPECIFIC (node), size); DECL_LANG_SPECIFIC (node) = ld; @@ -618,7 +618,7 @@ copy_lang_type (tree node) size = sizeof (struct lang_type); else size = sizeof (struct lang_type_ptrmem); - lt = GGC_NEWVAR (struct lang_type, size); + lt = ggc_alloc_lang_type (size); memcpy (lt, TYPE_LANG_SPECIFIC (node), size); TYPE_LANG_SPECIFIC (node) = lt; @@ -649,7 +649,8 @@ cxx_make_type (enum tree_code code) if (RECORD_OR_UNION_CODE_P (code) || code == BOUND_TEMPLATE_TEMPLATE_PARM) { - struct lang_type *pi = GGC_CNEW (struct lang_type); + struct lang_type *pi + = ggc_alloc_cleared_lang_type (sizeof (struct lang_type)); TYPE_LANG_SPECIFIC (t) = pi; pi->u.c.h.is_lang_type_class = 1; diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 0c759c6404a..db4246c5f70 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -102,7 +102,7 @@ binding_entry_make (tree name, tree type) free_binding_entry = entry->chain; } else - entry = GGC_NEW (struct binding_entry_s); + entry = ggc_alloc_binding_entry_s (); entry->name = name; entry->type = type; @@ -144,7 +144,7 @@ binding_table_construct (binding_table table, size_t chain_count) { table->chain_count = chain_count; table->entry_count = 0; - table->chain = GGC_CNEWVEC (binding_entry, table->chain_count); + table->chain = ggc_alloc_cleared_vec_binding_entry (table->chain_count); } /* Make TABLE's entries ready for reuse. */ @@ -178,7 +178,7 @@ binding_table_free (binding_table table) static inline binding_table binding_table_new (size_t chain_count) { - binding_table table = GGC_NEW (struct binding_table_s); + binding_table table = ggc_alloc_binding_table_s (); table->chain = NULL; binding_table_construct (table, chain_count); return table; @@ -292,7 +292,7 @@ cxx_binding_make (tree value, tree type) free_bindings = binding->previous; } else - binding = GGC_NEW (cxx_binding); + binding = ggc_alloc_cxx_binding (); cxx_binding_init (binding, value, type); @@ -707,7 +707,7 @@ pushdecl_maybe_friend (tree x, bool is_friend) = htab_create_ggc (20, cxx_int_tree_map_hash, cxx_int_tree_map_eq, NULL); - h = GGC_NEW (struct cxx_int_tree_map); + h = ggc_alloc_cxx_int_tree_map (); h->uid = DECL_UID (x); h->to = t; loc = htab_find_slot_with_hash @@ -1384,7 +1384,7 @@ begin_scope (scope_kind kind, tree entity) free_binding_level = scope->level_chain; } else - scope = GGC_CNEW (cxx_scope); + scope = ggc_alloc_cleared_cxx_scope (); scope->this_entity = entity; scope->more_cleanups_ok = true; @@ -5406,7 +5406,7 @@ push_to_top_level (void) bool need_pop; timevar_push (TV_NAME_LOOKUP); - s = GGC_CNEW (struct saved_scope); + s = ggc_alloc_cleared_saved_scope (); b = scope_chain ? current_binding_level : 0; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 92f778619eb..0a7006a7d1b 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -393,7 +393,7 @@ cp_lexer_new_main (void) c_common_no_more_pch (); /* Allocate the memory. */ - lexer = GGC_CNEW (cp_lexer); + lexer = ggc_alloc_cleared_cp_lexer (); #ifdef ENABLE_CHECKING /* Initially we are not debugging. */ @@ -404,7 +404,7 @@ cp_lexer_new_main (void) /* Create the buffer. */ alloc = CP_LEXER_BUFFER_SIZE; - buffer = GGC_NEWVEC (cp_token, alloc); + buffer = ggc_alloc_vec_cp_token (alloc); /* Put the first token in the buffer. */ space = alloc; @@ -445,7 +445,7 @@ cp_lexer_new_from_tokens (cp_token_cache *cache) { cp_token *first = cache->first; cp_token *last = cache->last; - cp_lexer *lexer = GGC_CNEW (cp_lexer); + cp_lexer *lexer = ggc_alloc_cleared_cp_lexer (); /* We do not own the buffer. */ lexer->buffer = NULL; @@ -946,7 +946,7 @@ cp_lexer_stop_debugging (cp_lexer* lexer) static cp_token_cache * cp_token_cache_new (cp_token *first, cp_token *last) { - cp_token_cache *cache = GGC_NEW (cp_token_cache); + cp_token_cache *cache = ggc_alloc_cp_token_cache (); cache->first = first; cache->last = last; return cache; @@ -1496,7 +1496,7 @@ cp_parser_context_new (cp_parser_context* next) memset (context, 0, sizeof (*context)); } else - context = GGC_CNEW (cp_parser_context); + context = ggc_alloc_cleared_cp_parser_context (); /* No errors have occurred yet in this context. */ context->status = CP_PARSER_STATUS_KIND_NO_ERROR; @@ -3093,7 +3093,7 @@ cp_parser_new (void) cp_lexer *lexer; unsigned i; - /* cp_lexer_new_main is called before calling ggc_alloc because + /* cp_lexer_new_main is called before doing GC allocation because cp_lexer_new_main might load a PCH file. */ lexer = cp_lexer_new_main (); @@ -3102,7 +3102,7 @@ cp_parser_new (void) for (i = 0; i < sizeof (binops) / sizeof (binops[0]); i++) binops_by_token[binops[i].token_type] = binops[i]; - parser = GGC_CNEW (cp_parser); + parser = ggc_alloc_cleared_cp_parser (); parser->lexer = lexer; parser->context = cp_parser_context_new (NULL); @@ -4605,7 +4605,7 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, token->type = CPP_NESTED_NAME_SPECIFIER; /* Retrieve any deferred checks. Do not pop this access checks yet so the memory will not be reclaimed during token replacing below. */ - token->u.tree_check_value = GGC_CNEW (struct tree_check); + token->u.tree_check_value = ggc_alloc_cleared_tree_check (); token->u.tree_check_value->value = parser->scope; token->u.tree_check_value->checks = get_deferred_access_checks (); token->u.tree_check_value->qualifying_scope = @@ -11275,7 +11275,7 @@ cp_parser_template_id (cp_parser *parser, token->type = CPP_TEMPLATE_ID; /* Retrieve any deferred checks. Do not pop this access checks yet so the memory will not be reclaimed during token replacing below. */ - token->u.tree_check_value = GGC_CNEW (struct tree_check); + token->u.tree_check_value = ggc_alloc_cleared_tree_check (); token->u.tree_check_value->value = template_id; token->u.tree_check_value->checks = get_deferred_access_checks (); token->keyword = RID_MAX; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d66c1bf6e2b..58b746fe16d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -888,7 +888,7 @@ maybe_process_partial_specialization (tree type) slot = (spec_entry **) htab_find_slot (type_specializations, &elt, INSERT); - *slot = GGC_NEW (spec_entry); + *slot = ggc_alloc_spec_entry (); **slot = elt; } else if (COMPLETE_OR_OPEN_TYPE_P (inst)) @@ -1401,7 +1401,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend, if (!optimize_specialization_lookup_p (tmpl)) { gcc_assert (tmpl && args && spec); - *slot = GGC_NEW (spec_entry); + *slot = ggc_alloc_spec_entry (); **slot = elt; if (TREE_CODE (spec) == FUNCTION_DECL && DECL_NAMESPACE_SCOPE_P (spec) && PRIMARY_TEMPLATE_P (tmpl) @@ -6155,7 +6155,7 @@ add_pending_template (tree d) if (level) push_tinst_level (d); - pt = GGC_NEW (struct pending_template); + pt = ggc_alloc_pending_template (); pt->next = NULL; pt->tinst = current_tinst_level; if (last_pending_template) @@ -6718,7 +6718,7 @@ lookup_template_class (tree d1, elt.spec = t; slot = (spec_entry **) htab_find_slot_with_hash (type_specializations, &elt, hash, INSERT); - *slot = GGC_NEW (spec_entry); + *slot = ggc_alloc_spec_entry (); **slot = elt; /* Note this use of the partial instantiation so we can check it @@ -7076,7 +7076,7 @@ push_tinst_level (tree d) return 0; } - new_level = GGC_NEW (struct tinst_level); + new_level = ggc_alloc_tinst_level (); new_level->decl = d; new_level->locus = input_location; new_level->in_system_header_p = in_system_header; diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index e7b97c4d5c7..335b1f3499a 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -352,7 +352,7 @@ abstract_virtuals_error (tree decl, tree type) slot = htab_find_slot_with_hash (abstract_pending_vars, type, (hashval_t)TYPE_UID (type), INSERT); - pat = GGC_NEW (struct pending_abstract_type); + pat = ggc_alloc_pending_abstract_type (); pat->type = type; pat->decl = decl; pat->locus = ((decl && DECL_P (decl)) |