utils.c (init_gnat_to_gnu): Use typed GC allocation.

gcc/ada:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC
	allocation.
	(init_dummy_type): Likewise.
	(gnat_pushlevel): Likewise.

	* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
	(Subprogram_Body_to_gnu): Likewise.
	(Compilation_Unit_to_gnu): Likewise.
	(start_stmt_group): Likewise.
	(extract_encoding): Likewise.
	(decode_name): Likewise.

	* gcc-interface/misc.c (gnat_printable_name): Likewise.

	* gcc-interface/decl.c (annotate_value): Likewise.

	* gcc-interface/ada-tree.h (struct lang_type): Add variable_size
	GTY option.
	(struct lang_decl): Likewise.
	(SET_TYPE_LANG_SPECIFIC): Use typed GC allocation.
	(SET_DECL_LANG_SPECIFIC): Likewise.

gcc/c-family:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* c-pragma.c (push_alignment): Use typed GC allocation.
	(handle_pragma_push_options): Likewise.

	* c-common.c (parse_optimize_options): Likewise.

	* c-common.h (struct sorted_fields_type): Add variable_size GTY
	option.

gcc/cp:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* typeck2.c (abstract_virtuals_error): Likewise.

	* 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.

gcc/fortran:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* trans-types.c (gfc_get_nodesc_array_type): Use typed GC
	allocation.
	(gfc_get_array_type_bounds): Likewise.

	* trans-decl.c (gfc_allocate_lang_decl): Likewise.
	(gfc_find_module): Likewise.

	* f95-lang.c (pushlevel): Likewise.

	* trans.h (struct lang_type): Add variable_size GTY option.
	(struct lang_decl): Likewise.

gcc/java:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.

	* jcf-parse.c (java_parse_file): Likewise.
	(process_zip_dir): Likewise.

	* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise.
	(MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.

	* expr.c (add_type_assertion): Likewise.

	* decl.c (make_binding_level): Likewise.
	(java_dup_lang_specific_decl): Likewise.

	* constants.c (set_constant_entry): Likewise.
	(cpool_for_class): Likewise.

	* class.c (add_method_1): Likewise.
	(java_treetreehash_new): Likewise.

	* java-tree.h (struct lang_type): Add variable_size GTY option.
	(struct lang_decl): Likewise.

	* jch.h (struct cpool_entry): Likewise.

	* java-tree.h (java_treetreehash_create): Remove parameter ggc.

	* except.c (prepare_eh_table_type): Update
	java_treetreehash_create call.

	* class.c (add_method_1): Update java_treetreehash_create call.
	(java_treetreehash_create): Remove parameter gc.  Use
	htab_create_ggc.

gcc/lto:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* lto.c (lto_read_in_decl_state): Use typed GC allocation.
	(lto_file_read): Likewise.
	(new_partition): Likewise.
	(read_cgraph_and_symbols): Likewise.

gcc/objc:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
	allocation.

	* objc-act.c (objc_volatilize_decl): Likewise.
	(objc_build_string_object): Likewise.
	(hash_init): Likewise.
	(hash_enter): Likewise.
	(hash_add_attr): Likewise.
	(add_class): Likewise.
	(start_class): Likewise.

gcc/objcp:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC
	allocation.

gcc:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* doc/tm.texi (Per-Function Data): Do not reference ggc_alloc.

	* doc/gty.texi (GTY Options): Document typed GC allocation and
	variable_size GTY option.

	* ggc-internal.h: New.

	* ggc.h: Update copyright year.
	(digit_string): Move to stringpool.c.
	(ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots)
	(gt_pch_save_stringpool, gt_pch_fixup_stringpool)
	(gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object)
	(init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size)
	(ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write)
	(ggc_pch_write_object, ggc_pch_finish, ggc_pch_read)
	(ggc_force_collect, ggc_get_size, ggc_statistics)
	(ggc_print_common_statistics): Move to ggc-internal.h.
	(digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat)
	(ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW)
	(GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec)
	(ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic)
	(ggc_min_heapsize_heuristic, ggc_alloc_zone)
	(ggc_alloc_zone_pass_stat): Remove.
	(ggc_internal_alloc_stat, ggc_internal_alloc)
	(ggc_internal_cleared_alloc_stat): New.
	(GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine.
	(ggc_internal_vec_alloc_stat)
	(ggc_internal_cleared_vec_alloc_stat)
	(ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc)
	(ggc_alloc_atomic_stat, ggc_alloc_atomic)
	(ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args)
	(ggc_cleared_alloc_ptr_array_two_args): New.
	(htab_create_ggc, splay_tree_new_ggc): Redefine.
	(ggc_splay_alloc): Change the type of the first argument to
	enum gt_types_enum.
	(ggc_alloc_string): Make macro.
	(ggc_alloc_string_stat): New.
	(ggc_strdup): Redefine.
	(rtl_zone, tree_zone, tree_id_zone): Declare unconditionally.
	(ggc_alloc_rtvec_sized): New.
	(ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat.
	(ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat)
	(ggc_internal_cleared_alloc_zone_stat)
	(ggc_internal_zone_alloc_stat)
	(ggc_internal_zone_cleared_alloc_stat)
	(ggc_internal_zone_vec_alloc_stat)
	(ggc_alloc_zone_rtx_def_stat)
	(ggc_alloc_zone_tree_node_stat)
	(ggc_alloc_zone_cleared_tree_node_stat)
	(ggc_alloc_cleared_gimple_statement_d_stat): New.

	* ggc-common.c: Include ggc-internal.h.
	(ggc_internal_cleared_alloc_stat): Rename from
	ggc_alloc_cleared_stat.
	(ggc_realloc_stat): Use ggc_internal_alloc_stat.
	(ggc_calloc): Remove.
	(ggc_cleared_alloc_htab_ignore_args): New.
	(ggc_cleared_alloc_ptr_array_two_args): New.
	(ggc_splay_alloc): Add obj_type parameter.
	(init_ggc_heuristics): Formatting fixes.

	* ggc-none.c: Update copyright year.
	(ggc_alloc_stat): Rename to ggc_alloc_stat.
	(ggc_alloc_cleared_stat): Rename to
	ggc_internal_cleared_alloc_stat.
	(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.

	* ggc-page.c: Update copyright year.  Include ggc-internal.h.
	Remove references to ggc_alloc in comments.
	(ggc_alloc_typed_stat): Call ggc_internal_alloc_stat.
	(ggc_alloc_stat): Rename to ggc_internal_alloc_stat.
	(new_ggc_zone, destroy_ggc_zone): Remove.
	(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.

	* ggc-zone.c: Include ggc-internal.h.  Remove references to
	ggc_alloc in comments.
	(ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat.
	(ggc_internal_alloc_zone_pass_stat): New.
	(ggc_internal_cleared_alloc_zone_stat): New.
	(ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat.
	(ggc_alloc_stat): Rename ggc_internal_alloc_stat.
	(new_ggc_zone, destroy_ggc_zone): Remove.

	* stringpool.c: Update copyright year.  Include ggc-internal.h
	(digit_vector): Make static.
	(digit_string): Moved from ggc.h.
	(stringpool_ggc_alloc): Use ggc_alloc_atomic.
	(ggc_alloc_string): Rename to ggc_alloc_string_stat.

	* Makefile.in (GGC_INTERNAL_H): New.
	(ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add
	$(GGC_INTERNAL_H) to dependencies.

	* gentype.c: Update copyright year.
	(walk_type): Accept variable_size GTY option.
	(USED_BY_TYPED_GC_P): New macro.
	(write_enum_defn): Use USED_BY_TYPED_GC_P.  Do not output
	whitespace at the end of strings.
	(get_type_specifier, variable_size_p): New functions.
	(alloc_quantity, alloc_zone): New enums.
	(write_typed_alloc_def): New function.
	(write_typed_struct_alloc_def): Likewise.
	(write_typed_typed_typedef_alloc_def): Likewise.
	(write_typed_alloc_defns): Likewise.
	(output_typename, write_splay_tree_allocator_def): Likewise.
	(write_splay_tree_allocators): Likewise.
	(main): Call write_typed_alloc_defns and
	write_splay_tree_allocators.

	* lto-streamer.h (lto_file_decl_data_ptr): New.

	* passes.c (order): Define using cgraph_node_ptr.

	* strinpool.c (struct string_pool_data): Declare nested_ptr using
	ht_identifier_ptr.

	* gimple.h (union gimple_statement_d): Likewise.

	* rtl.h (struct rtx_def): Likewise.
	(struct rtvec_def): Likewise.

	* tree.h (union tree_node): Likewise.

	* tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise.

	* cfgloop.c (record_loop_exits): Use htab_create_ggc.

	* tree-scalar-evolution.c (scev_initialize): Likewise.

	* alias.c (record_alias_subset): Update splay_tree_new_ggc call.

	* dwarf2asm.c (dw2_force_const_mem): Likewise.

	* omp-low.c (lower_omp_critical): Likewise.

	* bitmap.h (struct bitmap_head_def): Update comment to not
	reference ggc_alloc.

	* config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC.

	* ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC.

	* ipa-prop.c (duplicate_ggc_array): Rename to
	duplicate_ipa_jump_func_array.  Use typed GC allocation.
	(ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array.

	* gimple.c (gimple_alloc_stat): Use
	ggc_alloc_cleared_gimple_statement_d_stat.

	* varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def.

	* tree.c (make_node_stat): Use
	ggc_alloc_zone_cleared_tree_node_stat.
	(make_tree_vec_stat): Likewise.
	(build_vl_exp_stat): Likewise.
	(copy_node_stat): Use ggc_alloc_zone_tree_node_stat.
	(make_tree_binfo_stat): Likewise.
	(tree_cons_stat): Likewise.

	* rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat.
	(shallow_copy_rtx_stat): Likewise.
	(make_node_stat): Likewise.

	* lto-symtab.c: Fix comment.

	* tree-cfg.c (create_bb): Update comment to not reference
	ggc_alloc_cleared.
	* tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is
	value.

	* varpool.c (varpool_node): Use typed GC allocation.
	(varpool_extra_name_alias): Likewise.

	* varasm.c (emutls_decl): Likewise.
	(get_unnamed_section): Likewise.
	(get_noswitch_section): Likewise.
	(get_section): Likewise.
	(get_block_for_section): Likewise.
	(build_constant_desc): Likewise.
	(create_constant_pool): Likewise.
	(force_const_mem): Likewise.

	* tree.c (build_vl_exp_stat): Likewise.
	(build_real): Likewise.
	(build_string): Likewise.
	(decl_debug_expr_insert): Likewise.
	(decl_value_expr_insert): Likewise.
	(type_hash_add): Likewise.
	(build_omp_clause): Likewise.

	* tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise.

	* tree-ssa.c (init_tree_ssa): Likewise.

	* tree-ssa-structalias.c (heapvar_insert): Likewise.

	* tree-ssa-operands.c (ssa_operand_alloc): Likewise.

	* tree-ssa-loop-niter.c (record_estimate): Likewise.

	* tree-ssa-alias.c (get_ptr_info): Likewise.

	* tree-scalar-evolution.c (new_scev_info_str): Likewise.

	* tree-phinodes.c (allocate_phi_node): Likewise.

	* tree-iterator.c (tsi_link_before): Likewise.
	(tsi_link_after): Likewise.

	* tree-eh.c (add_stmt_to_eh_lp_fn): Likewise.

	* tree-dfa.c (create_var_ann): Likewise.

	* tree-cfg.c (create_bb): Likewise.

	* toplev.c (alloc_for_identifier_to_locale): Likewise.
	(general_init): Likewise.

	* stringpool.c (stringpool_ggc_alloc): Likewise.
	(gt_pch_save_stringpool): Likewise.

	* sese.c (if_region_set_false_region): Likewise.

	* passes.c (do_per_function_toporder): Likewise.

	* optabs.c (set_optab_libfunc): Likewise.
	(set_conv_libfunc): Likewise.

	* lto-symtab.c (lto_symtab_register_decl): Likewise.

	* lto-streamer-in.c (lto_input_eh_catch_list): Likewise.
	(input_eh_region): Likewise.
	(input_eh_lp): Likewise.
	(make_new_block): Likewise.
	(unpack_ts_real_cst_value_fields): Likewise.

	* lto-section-in.c (lto_new_in_decl_state): Likewise.

	* lto-cgraph.c (input_node_opt_summary): Likewise.

	* loop-init.c (loop_optimizer_init): Likewise.

	* lambda.h (lambda_vector_new): Likewise.

	* lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.

	* ira.c (update_equiv_regs): Likewise.

	* ipa.c (cgraph_node_set_new): Likewise.
	(cgraph_node_set_add): Likewise.
	(varpool_node_set_new): Likewise.
	(varpool_node_set_add): Likewise.

	* ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
	(duplicate_ipa_jump_func_array): Likewise.
	(ipa_read_node_info): Likewise.

	* ipa-cp.c (ipcp_create_replace_map): Likewise.

	* integrate.c (get_hard_reg_initial_val): Likewise.

	* gimple.c (gimple_alloc_stat): Likewise.
	(gimple_build_omp_for): Likewise.
	(gimple_seq_alloc): Likewise.
	(gimple_copy): Likewise.

	* gimple-iterator.c (gsi_insert_before_without_update): Likewise.
	(gsi_insert_after_without_update): Likewise.

	* function.c (add_frame_space): Likewise.
	(insert_temp_slot_address): Likewise.
	(assign_stack_temp_for_type): Likewise.
	(allocate_struct_function): Likewise.
	(types_used_by_var_decl_insert): Likewise.

	* except.c (init_eh_for_function): Likewise.
	(gen_eh_region): Likewise.
	(gen_eh_region_catch): Likewise.
	(gen_eh_landing_pad): Likewise.
	(add_call_site): Likewise.

	* emit-rtl.c (get_mem_attrs): Likewise.
	(get_reg_attrs): Likewise.
	(start_sequence): Likewise.
	(init_emit): Likewise.

	* dwarf2out.c (new_cfi): Likewise.
	(queue_reg_save): Likewise.
	(dwarf2out_frame_init): Likewise.
	(new_loc_descr): Likewise.
	(find_AT_string): Likewise.
	(new_die): Likewise.
	(add_var_loc_to_decl): Likewise.
	(clone_die): Likewise.
	(clone_as_declaration): Likewise.
	(break_out_comdat_types): Likewise.
	(new_loc_list): Likewise.
	(loc_descriptor): Likewise.
	(add_loc_descr_to_each): Likewise.
	(add_const_value_attribute): Likewise.
	(tree_add_const_value_attribute): Likewise.
	(add_comp_dir_attribute): Likewise.
	(add_name_and_src_coords_attributes): Likewise.
	(lookup_filename): Likewise.
	(store_vcall_insn): Likewise.
	(dwarf2out_init): Likewise.

	* dbxout.c (dbxout_init): Likewise.

	* config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.

	* config/sparc/sparc.c (sparc_init_machine_status): Likewise.

	* config/score/score7.c (score7_output_external): Likewise.

	* config/score/score3.c (score3_output_external): Likewise.

	* config/s390/s390.c (s390_init_machine_status): Likewise.

	* config/rs6000/rs6000.c (builtin_function_type): Likewise.
	(rs6000_init_machine_status): Likewise.
	(output_toc): Likewise.

	* config/pa/pa.c (pa_init_machine_status): Likewise.
	(get_deferred_plabel): Likewise.

	* config/moxie/moxie.c (moxie_init_machine_status): Likewise.

	* config/mmix/mmix.c (mmix_init_machine_status): Likewise.

	* config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise.

	* config/mep/mep.c (mep_init_machine_status): Likewise.
	(mep_note_pragma_flag): Likewise.

	* config/m32c/m32c.c (m32c_init_machine_status): Likewise.

	* config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise.

	* config/ia64/ia64.c (ia64_init_machine_status): Likewise.

	* config/i386/winnt.c (i386_pe_record_external_function): Likewise.
	(i386_pe_maybe_record_exported_symbol): Likewise.

	* config/i386/i386.c (get_dllimport_decl): Likewise.
	(ix86_init_machine_status): Likewise.
	(assign_386_stack_local): Likewise.

	* config/frv/frv.c (frv_init_machine_status): Likewise.

	* config/darwin.c (machopic_indirection_name): Likewise.

	* config/cris/cris.c (cris_init_machine_status): Likewise.

	* config/bfin/bfin.c (bfin_init_machine_status): Likewise.

	* config/avr/avr.c (avr_init_machine_status): Likewise.

	* config/arm/arm.c (arm_init_machine_status): Likewise.

	* config/alpha/alpha.c (alpha_init_machine_status): Likewise.
	(alpha_need_linkage): Likewise.
	(alpha_use_linkage): Likewise.

	* cgraph.c (cgraph_allocate_node): Likewise.
	(cgraph_create_edge_1): Likewise.
	(cgraph_create_indirect_edge): Likewise.
	(cgraph_add_asm_node): Likewise.

	* cfgrtl.c (init_rtl_bb_info): Likewise.

	* cfgloop.c (alloc_loop): Likewise.
	(rescan_loop_exit): Likewise.

	* cfg.c (init_flow): Likewise.
	(alloc_block): Likewise.
	(unchecked_make_edge): Likewise.

	* c-parser.c (c_parse_init): Likewise.
	(c_parse_file): Likewise.

	* c-decl.c (bind): Likewise.
	(record_inline_static): Likewise.
	(push_scope): Likewise.
	(make_label): Likewise.
	(lookup_label_for_goto): Likewise.
	(finish_struct): Likewise.
	(finish_enum): Likewise.
	(c_push_function_context): Likewise.

	* bitmap.c (bitmap_element_allocate): Likewise.
	(bitmap_gc_alloc_stat): Likewise.

	* alias.c (record_alias_subset): Likewise.
	(init_alias_analysis): Likewise.

include:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* splay-tree.h: Update copyright years.
	(splay_tree_s): Document fields.
	(splay_tree_new_typed_alloc): New.

	* hashtab.h: Update copyright years.
	(htab_create_typed_alloc): New.

libcpp:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* include/symtab.h (ht_identifier_ptr): New.

libiberty:

2010-06-08  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* splay-tree.c: Update copyright years.
	(splay_tree_new_typed_alloc): New.
	(splay_tree_new_with_allocator): Use it.

	* hashtab.c: Update copyright years.
	(htab_create_typed_alloc): New.
	(htab_create_alloc): Use it.

	* functions.texi: Regenerate.

From-SVN: r160425
This commit is contained in:
Laurynas Biveinis 2010-06-08 07:25:24 +00:00 committed by Laurynas Biveinis
parent c064bf1cef
commit a9429e29f5
141 changed files with 1767 additions and 694 deletions

View File

@ -1,3 +1,401 @@
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* doc/tm.texi (Per-Function Data): Do not reference ggc_alloc.
* doc/gty.texi (GTY Options): Document typed GC allocation and
variable_size GTY option.
* ggc-internal.h: New.
* ggc.h: Update copyright year.
(digit_string): Move to stringpool.c.
(ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots)
(gt_pch_save_stringpool, gt_pch_fixup_stringpool)
(gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object)
(init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size)
(ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write)
(ggc_pch_write_object, ggc_pch_finish, ggc_pch_read)
(ggc_force_collect, ggc_get_size, ggc_statistics)
(ggc_print_common_statistics): Move to ggc-internal.h.
(digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat)
(ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW)
(GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec)
(ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic)
(ggc_min_heapsize_heuristic, ggc_alloc_zone)
(ggc_alloc_zone_pass_stat): Remove.
(ggc_internal_alloc_stat, ggc_internal_alloc)
(ggc_internal_cleared_alloc_stat): New.
(GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine.
(ggc_internal_vec_alloc_stat)
(ggc_internal_cleared_vec_alloc_stat)
(ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc)
(ggc_alloc_atomic_stat, ggc_alloc_atomic)
(ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args)
(ggc_cleared_alloc_ptr_array_two_args): New.
(htab_create_ggc, splay_tree_new_ggc): Redefine.
(ggc_splay_alloc): Change the type of the first argument to
enum gt_types_enum.
(ggc_alloc_string): Make macro.
(ggc_alloc_string_stat): New.
(ggc_strdup): Redefine.
(rtl_zone, tree_zone, tree_id_zone): Declare unconditionally.
(ggc_alloc_rtvec_sized): New.
(ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat)
(ggc_internal_cleared_alloc_zone_stat)
(ggc_internal_zone_alloc_stat)
(ggc_internal_zone_cleared_alloc_stat)
(ggc_internal_zone_vec_alloc_stat)
(ggc_alloc_zone_rtx_def_stat)
(ggc_alloc_zone_tree_node_stat)
(ggc_alloc_zone_cleared_tree_node_stat)
(ggc_alloc_cleared_gimple_statement_d_stat): New.
* ggc-common.c: Include ggc-internal.h.
(ggc_internal_cleared_alloc_stat): Rename from
ggc_alloc_cleared_stat.
(ggc_realloc_stat): Use ggc_internal_alloc_stat.
(ggc_calloc): Remove.
(ggc_cleared_alloc_htab_ignore_args): New.
(ggc_cleared_alloc_ptr_array_two_args): New.
(ggc_splay_alloc): Add obj_type parameter.
(init_ggc_heuristics): Formatting fixes.
* ggc-none.c: Update copyright year.
(ggc_alloc_stat): Rename to ggc_alloc_stat.
(ggc_alloc_cleared_stat): Rename to
ggc_internal_cleared_alloc_stat.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-page.c: Update copyright year. Include ggc-internal.h.
Remove references to ggc_alloc in comments.
(ggc_alloc_typed_stat): Call ggc_internal_alloc_stat.
(ggc_alloc_stat): Rename to ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
(struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New.
* ggc-zone.c: Include ggc-internal.h. Remove references to
ggc_alloc in comments.
(ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat.
(ggc_internal_alloc_zone_pass_stat): New.
(ggc_internal_cleared_alloc_zone_stat): New.
(ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat.
(ggc_alloc_stat): Rename ggc_internal_alloc_stat.
(new_ggc_zone, destroy_ggc_zone): Remove.
* stringpool.c: Update copyright year. Include ggc-internal.h
(digit_vector): Make static.
(digit_string): Moved from ggc.h.
(stringpool_ggc_alloc): Use ggc_alloc_atomic.
(ggc_alloc_string): Rename to ggc_alloc_string_stat.
* Makefile.in (GGC_INTERNAL_H): New.
(ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add
$(GGC_INTERNAL_H) to dependencies.
* gentype.c: Update copyright year.
(walk_type): Accept variable_size GTY option.
(USED_BY_TYPED_GC_P): New macro.
(write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output
whitespace at the end of strings.
(get_type_specifier, variable_size_p): New functions.
(alloc_quantity, alloc_zone): New enums.
(write_typed_alloc_def): New function.
(write_typed_struct_alloc_def): Likewise.
(write_typed_typed_typedef_alloc_def): Likewise.
(write_typed_alloc_defns): Likewise.
(output_typename, write_splay_tree_allocator_def): Likewise.
(write_splay_tree_allocators): Likewise.
(main): Call write_typed_alloc_defns and
write_splay_tree_allocators.
* lto-streamer.h (lto_file_decl_data_ptr): New.
* passes.c (order): Define using cgraph_node_ptr.
* strinpool.c (struct string_pool_data): Declare nested_ptr using
ht_identifier_ptr.
* gimple.h (union gimple_statement_d): Likewise.
* rtl.h (struct rtx_def): Likewise.
(struct rtvec_def): Likewise.
* tree.h (union tree_node): Likewise.
* tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise.
* cfgloop.c (record_loop_exits): Use htab_create_ggc.
* tree-scalar-evolution.c (scev_initialize): Likewise.
* alias.c (record_alias_subset): Update splay_tree_new_ggc call.
* dwarf2asm.c (dw2_force_const_mem): Likewise.
* omp-low.c (lower_omp_critical): Likewise.
* bitmap.h (struct bitmap_head_def): Update comment to not
reference ggc_alloc.
* config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC.
* ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC.
* ipa-prop.c (duplicate_ggc_array): Rename to
duplicate_ipa_jump_func_array. Use typed GC allocation.
(ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array.
* gimple.c (gimple_alloc_stat): Use
ggc_alloc_cleared_gimple_statement_d_stat.
* varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def.
* tree.c (make_node_stat): Use
ggc_alloc_zone_cleared_tree_node_stat.
(make_tree_vec_stat): Likewise.
(build_vl_exp_stat): Likewise.
(copy_node_stat): Use ggc_alloc_zone_tree_node_stat.
(make_tree_binfo_stat): Likewise.
(tree_cons_stat): Likewise.
* rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat.
(shallow_copy_rtx_stat): Likewise.
(make_node_stat): Likewise.
* lto-symtab.c: Fix comment.
* tree-cfg.c (create_bb): Update comment to not reference
ggc_alloc_cleared.
* tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is
value.
* varpool.c (varpool_node): Use typed GC allocation.
(varpool_extra_name_alias): Likewise.
* varasm.c (emutls_decl): Likewise.
(get_unnamed_section): Likewise.
(get_noswitch_section): Likewise.
(get_section): Likewise.
(get_block_for_section): Likewise.
(build_constant_desc): Likewise.
(create_constant_pool): Likewise.
(force_const_mem): Likewise.
* tree.c (build_vl_exp_stat): Likewise.
(build_real): Likewise.
(build_string): Likewise.
(decl_debug_expr_insert): Likewise.
(decl_value_expr_insert): Likewise.
(type_hash_add): Likewise.
(build_omp_clause): Likewise.
* tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise.
* tree-ssa.c (init_tree_ssa): Likewise.
* tree-ssa-structalias.c (heapvar_insert): Likewise.
* tree-ssa-operands.c (ssa_operand_alloc): Likewise.
* tree-ssa-loop-niter.c (record_estimate): Likewise.
* tree-ssa-alias.c (get_ptr_info): Likewise.
* tree-scalar-evolution.c (new_scev_info_str): Likewise.
* tree-phinodes.c (allocate_phi_node): Likewise.
* tree-iterator.c (tsi_link_before): Likewise.
(tsi_link_after): Likewise.
* tree-eh.c (add_stmt_to_eh_lp_fn): Likewise.
* tree-dfa.c (create_var_ann): Likewise.
* tree-cfg.c (create_bb): Likewise.
* toplev.c (alloc_for_identifier_to_locale): Likewise.
(general_init): Likewise.
* stringpool.c (stringpool_ggc_alloc): Likewise.
(gt_pch_save_stringpool): Likewise.
* sese.c (if_region_set_false_region): Likewise.
* passes.c (do_per_function_toporder): Likewise.
* optabs.c (set_optab_libfunc): Likewise.
(set_conv_libfunc): Likewise.
* lto-symtab.c (lto_symtab_register_decl): Likewise.
* lto-streamer-in.c (lto_input_eh_catch_list): Likewise.
(input_eh_region): Likewise.
(input_eh_lp): Likewise.
(make_new_block): Likewise.
(unpack_ts_real_cst_value_fields): Likewise.
* lto-section-in.c (lto_new_in_decl_state): Likewise.
* lto-cgraph.c (input_node_opt_summary): Likewise.
* loop-init.c (loop_optimizer_init): Likewise.
* lambda.h (lambda_vector_new): Likewise.
* lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise.
* ira.c (update_equiv_regs): Likewise.
* ipa.c (cgraph_node_set_new): Likewise.
(cgraph_node_set_add): Likewise.
(varpool_node_set_new): Likewise.
(varpool_node_set_add): Likewise.
* ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
(duplicate_ipa_jump_func_array): Likewise.
(ipa_read_node_info): Likewise.
* ipa-cp.c (ipcp_create_replace_map): Likewise.
* integrate.c (get_hard_reg_initial_val): Likewise.
* gimple.c (gimple_alloc_stat): Likewise.
(gimple_build_omp_for): Likewise.
(gimple_seq_alloc): Likewise.
(gimple_copy): Likewise.
* gimple-iterator.c (gsi_insert_before_without_update): Likewise.
(gsi_insert_after_without_update): Likewise.
* function.c (add_frame_space): Likewise.
(insert_temp_slot_address): Likewise.
(assign_stack_temp_for_type): Likewise.
(allocate_struct_function): Likewise.
(types_used_by_var_decl_insert): Likewise.
* except.c (init_eh_for_function): Likewise.
(gen_eh_region): Likewise.
(gen_eh_region_catch): Likewise.
(gen_eh_landing_pad): Likewise.
(add_call_site): Likewise.
* emit-rtl.c (get_mem_attrs): Likewise.
(get_reg_attrs): Likewise.
(start_sequence): Likewise.
(init_emit): Likewise.
* dwarf2out.c (new_cfi): Likewise.
(queue_reg_save): Likewise.
(dwarf2out_frame_init): Likewise.
(new_loc_descr): Likewise.
(find_AT_string): Likewise.
(new_die): Likewise.
(add_var_loc_to_decl): Likewise.
(clone_die): Likewise.
(clone_as_declaration): Likewise.
(break_out_comdat_types): Likewise.
(new_loc_list): Likewise.
(loc_descriptor): Likewise.
(add_loc_descr_to_each): Likewise.
(add_const_value_attribute): Likewise.
(tree_add_const_value_attribute): Likewise.
(add_comp_dir_attribute): Likewise.
(add_name_and_src_coords_attributes): Likewise.
(lookup_filename): Likewise.
(store_vcall_insn): Likewise.
(dwarf2out_init): Likewise.
* dbxout.c (dbxout_init): Likewise.
* config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise.
* config/sparc/sparc.c (sparc_init_machine_status): Likewise.
* config/score/score7.c (score7_output_external): Likewise.
* config/score/score3.c (score3_output_external): Likewise.
* config/s390/s390.c (s390_init_machine_status): Likewise.
* config/rs6000/rs6000.c (builtin_function_type): Likewise.
(rs6000_init_machine_status): Likewise.
(output_toc): Likewise.
* config/pa/pa.c (pa_init_machine_status): Likewise.
(get_deferred_plabel): Likewise.
* config/moxie/moxie.c (moxie_init_machine_status): Likewise.
* config/mmix/mmix.c (mmix_init_machine_status): Likewise.
* config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise.
* config/mep/mep.c (mep_init_machine_status): Likewise.
(mep_note_pragma_flag): Likewise.
* config/m32c/m32c.c (m32c_init_machine_status): Likewise.
* config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise.
* config/ia64/ia64.c (ia64_init_machine_status): Likewise.
* config/i386/winnt.c (i386_pe_record_external_function): Likewise.
(i386_pe_maybe_record_exported_symbol): Likewise.
* config/i386/i386.c (get_dllimport_decl): Likewise.
(ix86_init_machine_status): Likewise.
(assign_386_stack_local): Likewise.
* config/frv/frv.c (frv_init_machine_status): Likewise.
* config/darwin.c (machopic_indirection_name): Likewise.
* config/cris/cris.c (cris_init_machine_status): Likewise.
* config/bfin/bfin.c (bfin_init_machine_status): Likewise.
* config/avr/avr.c (avr_init_machine_status): Likewise.
* config/arm/arm.c (arm_init_machine_status): Likewise.
* config/alpha/alpha.c (alpha_init_machine_status): Likewise.
(alpha_need_linkage): Likewise.
(alpha_use_linkage): Likewise.
* cgraph.c (cgraph_allocate_node): Likewise.
(cgraph_create_edge_1): Likewise.
(cgraph_create_indirect_edge): Likewise.
(cgraph_add_asm_node): Likewise.
* cfgrtl.c (init_rtl_bb_info): Likewise.
* cfgloop.c (alloc_loop): Likewise.
(rescan_loop_exit): Likewise.
* cfg.c (init_flow): Likewise.
(alloc_block): Likewise.
(unchecked_make_edge): Likewise.
* c-parser.c (c_parse_init): Likewise.
(c_parse_file): Likewise.
* c-decl.c (bind): Likewise.
(record_inline_static): Likewise.
(push_scope): Likewise.
(make_label): Likewise.
(lookup_label_for_goto): Likewise.
(finish_struct): Likewise.
(finish_enum): Likewise.
(c_push_function_context): Likewise.
* bitmap.c (bitmap_element_allocate): Likewise.
(bitmap_gc_alloc_stat): Likewise.
* alias.c (record_alias_subset): Likewise.
(init_alias_analysis): Likewise.
2010-06-08 Shujing Zhao <pearly.zhao@oracle.com>
* fold-const.c (fold_comparison): Remove redundant parenthesis.

View File

@ -914,6 +914,7 @@ RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
DDG_H = ddg.h sbitmap.h $(DF_H)
GCC_H = gcc.h version.h $(DIAGNOSTIC_CORE_H)
GGC_H = ggc.h gtype-desc.h statistics.h
GGC_INTERNAL_H = ggc-internal.h $(GGC_H)
TIMEVAR_H = timevar.h timevar.def
INSN_ATTR_H = insn-attr.h $(INSN_ADDR_H)
INSN_ADDR_H = $(srcdir)/insn-addr.h vecprim.h
@ -2246,20 +2247,21 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(GGC_H) $(HASHTAB_H) $(TOPLEV_H) $(PARAMS_H) hosthooks.h \
$(HOSTHOOKS_DEF_H) $(VEC_H) $(PLUGIN_H) $(TIMEVAR_H)
$(HOSTHOOKS_DEF_H) $(VEC_H) $(PLUGIN_H) $(GGC_INTERNAL_H) $(TIMEVAR_H)
ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
$(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) $(TREE_FLOW_H) $(PLUGIN_H)
$(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) \
$(TREE_FLOW_H) $(PLUGIN_H) $(GGC_INTERNAL_H)
ggc-zone.o: ggc-zone.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(TOPLEV_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) \
$(PARAMS_H) $(BITMAP_H) $(PLUGIN_H)
$(PARAMS_H) $(BITMAP_H) $(PLUGIN_H) $(GGC_INTERNAL_H)
ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
$(BCONFIG_H)
stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(GGC_H) gt-stringpool.h $(CPPLIB_H) $(SYMTAB_H)
$(TREE_H) $(GGC_H) $(GGC_INTERNAL_H) gt-stringpool.h $(CPPLIB_H) $(SYMTAB_H)
convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(FLAGS_H) convert.h $(TOPLEV_H) langhooks.h

View File

@ -1,3 +1,27 @@
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC
allocation.
(init_dummy_type): Likewise.
(gnat_pushlevel): Likewise.
* gcc-interface/trans.c (Attribute_to_gnu): Likewise.
(Subprogram_Body_to_gnu): Likewise.
(Compilation_Unit_to_gnu): Likewise.
(start_stmt_group): Likewise.
(extract_encoding): Likewise.
(decode_name): Likewise.
* gcc-interface/misc.c (gnat_printable_name): Likewise.
* gcc-interface/decl.c (annotate_value): Likewise.
* gcc-interface/ada-tree.h (struct lang_type): Add variable_size
GTY option.
(struct lang_decl): Likewise.
(SET_TYPE_LANG_SPECIFIC): Use typed GC allocation.
(SET_DECL_LANG_SPECIFIC): Likewise.
2010-06-04 Eric Botcazou <ebotcazou@adacore.com>
* gnatlink.adb (gnatlink): Remove support for -fsjlj switch.

View File

@ -32,32 +32,37 @@ union GTY((desc ("0"),
desc ("tree_node_structure (&%h)"))) generic;
};
/* Ada uses the lang_decl and lang_type fields to hold a tree. */
struct GTY(()) lang_type { tree t; };
struct GTY(()) lang_decl { tree t; };
/* Ada uses the lang_decl and lang_type fields to hold a tree.
FIXME: the variable_size annotation here is needed because these types are
variable-sized in some other frontends. Due to gengtype deficiency the GTY
options of such types have to agree across all frontends. */
struct GTY((variable_size)) lang_type { tree t; };
struct GTY((variable_size)) lang_decl { tree t; };
/* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */
#define GET_TYPE_LANG_SPECIFIC(NODE) \
(TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE)
#define SET_TYPE_LANG_SPECIFIC(NODE, X) \
do { \
tree tmp = (X); \
if (!TYPE_LANG_SPECIFIC (NODE)) \
TYPE_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_type); \
TYPE_LANG_SPECIFIC (NODE)->t = tmp; \
#define SET_TYPE_LANG_SPECIFIC(NODE, X) \
do { \
tree tmp = (X); \
if (!TYPE_LANG_SPECIFIC (NODE)) \
TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_lang_type \
(sizeof (struct lang_type)); \
TYPE_LANG_SPECIFIC (NODE)->t = tmp; \
} while (0)
/* Macros to get and set the tree in DECL_LANG_SPECIFIC. */
#define GET_DECL_LANG_SPECIFIC(NODE) \
(DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE)
#define SET_DECL_LANG_SPECIFIC(NODE, X) \
do { \
tree tmp = (X); \
if (!DECL_LANG_SPECIFIC (NODE)) \
DECL_LANG_SPECIFIC (NODE) = GGC_NEW (struct lang_decl); \
DECL_LANG_SPECIFIC (NODE)->t = tmp; \
#define SET_DECL_LANG_SPECIFIC(NODE, X) \
do { \
tree tmp = (X); \
if (!DECL_LANG_SPECIFIC (NODE)) \
DECL_LANG_SPECIFIC (NODE) = ggc_alloc_lang_decl \
(sizeof (struct lang_decl)); \
DECL_LANG_SPECIFIC (NODE)->t = tmp; \
} while (0)

View File

@ -7296,7 +7296,7 @@ annotate_value (tree gnu_size)
/* Save the result in the cache. */
if (h)
{
*h = GGC_NEW (struct tree_int_map);
*h = ggc_alloc_tree_int_map ();
(*h)->base.from = gnu_size;
(*h)->to = ret;
}

View File

@ -574,7 +574,7 @@ static const char *
gnat_printable_name (tree decl, int verbosity)
{
const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl));
char *ada_name = (char *) ggc_alloc (strlen (coded_name) * 2 + 60);
char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 60);
__gnat_decode (coded_name, ada_name, 0);

View File

@ -1605,7 +1605,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
if (!pa)
{
pa = GGC_CNEW (struct parm_attr_d);
pa = ggc_alloc_cleared_parm_attr_d ();
pa->id = gnat_param;
pa->dim = Dimension;
VEC_safe_push (parm_attr, gc, f_parm_attr_cache, pa);
@ -2441,7 +2441,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
/* Initialize the information structure for the function. */
allocate_struct_function (gnu_subprog_decl, false);
DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language
= GGC_CNEW (struct language_function);
= ggc_alloc_cleared_language_function ();
set_cfun (NULL);
begin_subprog_body (gnu_subprog_decl);
@ -3626,7 +3626,7 @@ Compilation_Unit_to_gnu (Node_Id gnat_node)
/* Save away what we've made so far and record this potential elaboration
procedure. */
info = (struct elab_info *) ggc_alloc (sizeof (struct elab_info));
info = ggc_alloc_elab_info ();
set_current_block_context (gnu_elab_proc_decl);
gnat_poplevel ();
DECL_SAVED_TREE (gnu_elab_proc_decl) = end_stmt_group ();
@ -5722,7 +5722,7 @@ start_stmt_group (void)
if (group)
stmt_group_free_list = group->previous;
else
group = (struct stmt_group *) ggc_alloc (sizeof (struct stmt_group));
group = ggc_alloc_stmt_group ();
group->previous = current_stmt_group;
group->stmt_list = group->block = group->cleanups = NULL_TREE;
@ -7498,7 +7498,7 @@ set_expr_location_from_node (tree node, Node_Id gnat_node)
static const char *
extract_encoding (const char *name)
{
char *encoding = GGC_NEWVEC (char, strlen (name));
char *encoding = (char *) ggc_alloc_atomic (strlen (name));
get_encoding (name, encoding);
return encoding;
}
@ -7508,7 +7508,7 @@ extract_encoding (const char *name)
static const char *
decode_name (const char *name)
{
char *decoded = GGC_NEWVEC (char, strlen (name) * 2 + 60);
char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60);
__gnat_decode (name, decoded, 0);
return decoded;
}

View File

@ -206,8 +206,7 @@ static void process_attributes (tree, struct attrib *);
void
init_gnat_to_gnu (void)
{
associate_gnat_to_gnu
= (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree));
associate_gnat_to_gnu = ggc_alloc_cleared_vec_tree (max_gnat_nodes);
}
/* GNAT_ENTITY is a GNAT tree node for an entity. GNU_DECL is the GCC tree
@ -257,8 +256,7 @@ present_gnu_tree (Entity_Id gnat_entity)
void
init_dummy_type (void)
{
dummy_node_table
= (tree *) ggc_alloc_cleared (max_gnat_nodes * sizeof (tree));
dummy_node_table = ggc_alloc_cleared_vec_tree (max_gnat_nodes);
}
/* Make a dummy type corresponding to GNAT_TYPE. */
@ -321,9 +319,7 @@ gnat_pushlevel (void)
free_binding_level = free_binding_level->chain;
}
else
newlevel
= (struct gnat_binding_level *)
ggc_alloc (sizeof (struct gnat_binding_level));
newlevel = ggc_alloc_gnat_binding_level ();
/* Use a free BLOCK, if any; otherwise, allocate one. */
if (free_block_chain)

View File

@ -823,10 +823,12 @@ record_alias_subset (alias_set_type superset, alias_set_type subset)
{
/* Create an entry for the SUPERSET, so that we have a place to
attach the SUBSET. */
superset_entry = GGC_NEW (struct alias_set_entry_d);
superset_entry = ggc_alloc_cleared_alias_set_entry_d ();
superset_entry->alias_set = superset;
superset_entry->children
= splay_tree_new_ggc (splay_tree_compare_ints);
= splay_tree_new_ggc (splay_tree_compare_ints,
ggc_alloc_splay_tree_scalar_scalar_splay_tree_s,
ggc_alloc_splay_tree_scalar_scalar_splay_tree_node_s);
superset_entry->has_zero_child = 0;
VEC_replace (alias_set_entry, alias_sets, superset, superset_entry);
}
@ -2639,7 +2641,7 @@ init_alias_analysis (void)
timevar_push (TV_ALIAS_ANALYSIS);
reg_known_value_size = maxreg - FIRST_PSEUDO_REGISTER;
reg_known_value = GGC_CNEWVEC (rtx, reg_known_value_size);
reg_known_value = ggc_alloc_cleared_vec_rtx (reg_known_value_size);
reg_known_equiv_p = XCNEWVEC (bool, reg_known_value_size);
/* If we have memory allocated from the previous run, use it. */

View File

@ -230,7 +230,7 @@ bitmap_element_allocate (bitmap head)
/* Inner list was just a singleton. */
bitmap_ggc_free = element->prev;
else
element = GGC_NEW (bitmap_element);
element = ggc_alloc_bitmap_element_def ();
}
#ifdef GATHER_STATISTICS
@ -375,7 +375,7 @@ bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL)
{
bitmap map;
map = GGC_NEW (struct bitmap_head_def);
map = ggc_alloc_bitmap_head_def ();
bitmap_initialize_stat (map, NULL PASS_MEM_STAT);
#ifdef GATHER_STATISTICS
register_overhead (map, sizeof (bitmap_head));

View File

@ -77,7 +77,7 @@ typedef struct GTY(()) bitmap_head_def {
bitmap_element *current; /* Last element looked at. */
unsigned int indx; /* Index of last element looked at. */
bitmap_obstack *obstack; /* Obstack to allocate elements from.
If NULL, then use ggc_alloc. */
If NULL, then use GGC allocation. */
#ifdef GATHER_STATISTICS
struct bitmap_descriptor GTY((skip)) *desc;
#endif

View File

@ -590,7 +590,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible,
binding_freelist = b->prev;
}
else
b = GGC_NEW (struct c_binding);
b = ggc_alloc_c_binding ();
b->shadowed = 0;
b->decl = decl;
@ -704,7 +704,7 @@ void
record_inline_static (location_t loc, tree func, tree decl,
enum c_inline_static_type type)
{
struct c_inline_static *csi = GGC_NEW (struct c_inline_static);
struct c_inline_static *csi = ggc_alloc_c_inline_static ();
csi->location = loc;
csi->function = func;
csi->static_decl = decl;
@ -928,7 +928,7 @@ push_scope (void)
scope_freelist = scope->outer;
}
else
scope = GGC_CNEW (struct c_scope);
scope = ggc_alloc_cleared_c_scope ();
/* The FLOAT_CONST_DECIMAL64 pragma applies to nested scopes. */
if (current_scope)
@ -3007,7 +3007,7 @@ make_label (location_t location, tree name, bool defining,
DECL_CONTEXT (label) = current_function_decl;
DECL_MODE (label) = VOIDmode;
label_vars = GGC_NEW (struct c_label_vars);
label_vars = ggc_alloc_c_label_vars ();
label_vars->shadowed = NULL;
set_spot_bindings (&label_vars->label_bindings, defining);
label_vars->decls_in_scope = make_tree_vector ();
@ -3105,7 +3105,7 @@ lookup_label_for_goto (location_t loc, tree name)
{
struct c_goto_bindings *g;
g = GGC_NEW (struct c_goto_bindings);
g = ggc_alloc_c_goto_bindings ();
g->loc = loc;
set_spot_bindings (&g->goto_bindings, true);
VEC_safe_push (c_goto_bindings_p, gc, label_vars->gotos, g);
@ -6987,9 +6987,9 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
ensure that this lives as long as the rest of the struct decl.
All decls in an inline function need to be saved. */
space = GGC_CNEW (struct lang_type);
space2 = GGC_NEWVAR (struct sorted_fields_type,
sizeof (struct sorted_fields_type) + len * sizeof (tree));
space = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
space2 = ggc_alloc_sorted_fields_type
(sizeof (struct sorted_fields_type) + len * sizeof (tree));
len = 0;
space->s = space2;
@ -7270,7 +7270,7 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* Record the min/max values so that we can warn about bit-field
enumerations that are too small for the values. */
lt = GGC_CNEW (struct lang_type);
lt = ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
lt->enum_min = minnode;
lt->enum_max = maxnode;
TYPE_LANG_SPECIFIC (enumtype) = lt;
@ -8293,7 +8293,7 @@ void
c_push_function_context (void)
{
struct language_function *p;
p = GGC_NEW (struct language_function);
p = ggc_alloc_language_function ();
cfun->language = p;
p->base.x_stmt_tree = c_stmt_tree;

View File

@ -1,3 +1,13 @@
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* c-pragma.c (push_alignment): Use typed GC allocation.
(handle_pragma_push_options): Likewise.
* c-common.c (parse_optimize_options): Likewise.
* c-common.h (struct sorted_fields_type): Add variable_size GTY
option.
2010-06-07 Joseph Myers <joseph@codesourcery.com>
* c-common.c (flag_preprocess_only, flag_undef, flag_no_builtin,

View File

@ -7684,7 +7684,7 @@ parse_optimize_options (tree args, bool attr_p)
next_p = NULL;
}
r = q = (char *) ggc_alloc (len2 + 3);
r = q = (char *) ggc_alloc_atomic (len2 + 3);
/* If the user supplied -Oxxx or -fxxx, only allow -Oxxx or -fxxx
options. */

View File

@ -373,7 +373,7 @@ extern GTY(()) tree c_global_trees[CTI_MAX];
/* In a RECORD_TYPE, a sorted array of the fields of the type, not a
tree for size reasons. */
struct GTY(()) sorted_fields_type {
struct GTY((variable_size)) sorted_fields_type {
int len;
tree GTY((length ("%h.len"))) elts[1];
};

View File

@ -77,7 +77,7 @@ push_alignment (int alignment, tree id)
{
align_stack * entry;
entry = GGC_NEW (align_stack);
entry = ggc_alloc_align_stack ();
entry->alignment = alignment;
entry->id = id;
@ -914,7 +914,7 @@ handle_pragma_push_options (cpp_reader *ARG_UNUSED(dummy))
return;
}
p = GGC_NEW (opt_stack);
p = ggc_alloc_opt_stack ();
p->prev = options_stack;
options_stack = p;

View File

@ -86,7 +86,7 @@ c_parse_init (void)
if (!c_dialect_objc ())
mask |= D_OBJC | D_CXX_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 a keyword is disabled, do not enter it into the table
@ -8882,7 +8882,7 @@ c_parse_file (void)
if (c_parser_peek_token (&tparser)->pragma_kind == PRAGMA_GCC_PCH_PREPROCESS)
c_parser_pragma_pch_preprocess (&tparser);
the_parser = GGC_NEW (c_parser);
the_parser = ggc_alloc_c_parser ();
*the_parser = tparser;
/* Initialize EH, if we've been told to do so. */

View File

@ -84,13 +84,13 @@ void
init_flow (struct function *the_fun)
{
if (!the_fun->cfg)
the_fun->cfg = GGC_CNEW (struct control_flow_graph);
the_fun->cfg = ggc_alloc_cleared_control_flow_graph ();
n_edges_for_function (the_fun) = 0;
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)
= GGC_CNEW (struct basic_block_def);
= ggc_alloc_cleared_basic_block_def ();
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = ENTRY_BLOCK;
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)
= GGC_CNEW (struct basic_block_def);
= ggc_alloc_cleared_basic_block_def ();
EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun)->index = EXIT_BLOCK;
ENTRY_BLOCK_PTR_FOR_FUNCTION (the_fun)->next_bb
= EXIT_BLOCK_PTR_FOR_FUNCTION (the_fun);
@ -139,7 +139,7 @@ basic_block
alloc_block (void)
{
basic_block bb;
bb = GGC_CNEW (struct basic_block_def);
bb = ggc_alloc_cleared_basic_block_def ();
return bb;
}
@ -277,7 +277,7 @@ edge
unchecked_make_edge (basic_block src, basic_block dst, int flags)
{
edge e;
e = GGC_CNEW (struct edge_def);
e = ggc_alloc_cleared_edge_def ();
n_edges++;
e->src = src;

View File

@ -334,9 +334,9 @@ flow_loop_tree_node_remove (struct loop *loop)
struct loop *
alloc_loop (void)
{
struct loop *loop = GGC_CNEW (struct loop);
struct loop *loop = ggc_alloc_cleared_loop ();
loop->exits = GGC_CNEW (struct loop_exit);
loop->exits = ggc_alloc_cleared_loop_exit ();
loop->exits->next = loop->exits->prev = loop->exits;
loop->can_be_parallel = false;
loop->single_iv = NULL_TREE;
@ -1026,7 +1026,7 @@ rescan_loop_exit (edge e, bool new_edge, bool removed)
aloop != cloop;
aloop = loop_outer (aloop))
{
exit = GGC_NEW (struct loop_exit);
exit = ggc_alloc_loop_exit ();
exit->e = e;
exit->next = aloop->exits->next;
@ -1076,11 +1076,9 @@ record_loop_exits (void)
loops_state_set (LOOPS_HAVE_RECORDED_EXITS);
gcc_assert (current_loops->exits == NULL);
current_loops->exits = htab_create_alloc (2 * number_of_loops (),
loop_exit_hash,
loop_exit_eq,
loop_exit_free,
ggc_calloc, ggc_free);
current_loops->exits = htab_create_ggc (2 * number_of_loops (),
loop_exit_hash, loop_exit_eq,
loop_exit_free);
FOR_EACH_BB (bb)
{

View File

@ -3080,7 +3080,7 @@ void
init_rtl_bb_info (basic_block bb)
{
gcc_assert (!bb->il.rtl);
bb->il.rtl = GGC_CNEW (struct rtl_bb_info);
bb->il.rtl = ggc_alloc_cleared_rtl_bb_info ();
}

View File

@ -442,7 +442,7 @@ cgraph_allocate_node (void)
}
else
{
node = GGC_CNEW (struct cgraph_node);
node = ggc_alloc_cleared_cgraph_node ();
node->uid = cgraph_max_uid++;
}
@ -970,7 +970,7 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
}
else
{
edge = GGC_NEW (struct cgraph_edge);
edge = ggc_alloc_cgraph_edge ();
edge->uid = cgraph_edge_max_uid++;
}
@ -1045,7 +1045,7 @@ cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt,
edge->indirect_unknown_callee = 1;
initialize_inline_failed (edge);
edge->indirect_info = GGC_CNEW (struct cgraph_indirect_call_info);
edge->indirect_info = ggc_alloc_cleared_cgraph_indirect_call_info ();
edge->indirect_info->param_index = -1;
edge->indirect_info->ecf_flags = ecf_flags;
@ -1973,7 +1973,7 @@ cgraph_add_asm_node (tree asm_str)
{
struct cgraph_asm_node *node;
node = GGC_CNEW (struct cgraph_asm_node);
node = ggc_alloc_cleared_cgraph_asm_node ();
node->asm_str = asm_str;
node->order = cgraph_order++;
node->next = NULL;

View File

@ -4806,8 +4806,7 @@ struct GTY(()) machine_function
static struct machine_function *
alpha_init_machine_status (void)
{
return ((struct machine_function *)
ggc_alloc_cleared (sizeof (struct machine_function)));
return ggc_alloc_cleared_machine_function ();
}
/* Support for frame based VMS condition handlers. */
@ -9904,7 +9903,7 @@ alpha_need_linkage (const char *name, int is_local)
alpha_funcs_tree = splay_tree_new_ggc ((splay_tree_compare_fn)
splay_tree_compare_pointers);
cfaf = (struct alpha_funcs *) ggc_alloc (sizeof (struct alpha_funcs));
cfaf = ggc_alloc_alpha_funcs ();
cfaf->links = 0;
cfaf->num = ++alpha_funcs_num;
@ -9940,7 +9939,7 @@ alpha_need_linkage (const char *name, int is_local)
else
alpha_links_tree = splay_tree_new_ggc ((splay_tree_compare_fn) strcmp);
al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
al = ggc_alloc_alpha_links ();
name = ggc_strdup (name);
/* Assume external if no definition. */
@ -10012,7 +10011,7 @@ alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
name_len = strlen (name);
linksym = (char *) alloca (name_len + 50);
al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
al = ggc_alloc_alpha_links ();
al->num = cfaf->num;
node = splay_tree_lookup (alpha_links_tree, (splay_tree_key) name);

View File

@ -19280,7 +19280,7 @@ static struct machine_function *
arm_init_machine_status (void)
{
struct machine_function *machine;
machine = (machine_function *) ggc_alloc_cleared (sizeof (machine_function));
machine = ggc_alloc_cleared_machine_function ();
#if ARM_FT_UNKNOWN != 0
machine->func_type = ARM_FT_UNKNOWN;

View File

@ -243,8 +243,7 @@ static const enum reg_class reg_class_tab[]={
static struct machine_function *
avr_init_machine_status (void)
{
return ((struct machine_function *)
ggc_alloc_cleared (sizeof (struct machine_function)));
return ggc_alloc_cleared_machine_function ();
}
/* Return register class for register R. */

View File

@ -2634,11 +2634,7 @@ bfin_handle_option (size_t code, const char *arg, int value)
static struct machine_function *
bfin_init_machine_status (void)
{
struct machine_function *f;
f = GGC_CNEW (struct machine_function);
return f;
return ggc_alloc_cleared_machine_function ();
}
/* Implement the macro OVERRIDE_OPTIONS. */

View File

@ -2583,7 +2583,7 @@ cris_init_expanders (void)
static struct machine_function *
cris_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* Split a 2 word move (DI or presumably DF) into component parts.

View File

@ -429,7 +429,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p)
}
else
{
p = (machopic_indirection *) ggc_alloc (sizeof (machopic_indirection));
p = ggc_alloc_machopic_indirection ();
p->symbol = sym_ref;
p->ptr_name = xstrdup (buffer);
p->stub_p = stub_p;

View File

@ -7054,7 +7054,7 @@ frv_assemble_integer (rtx value, unsigned int size, int aligned_p)
static struct machine_function *
frv_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* Implement TARGET_SCHED_ISSUE_RATE. */

View File

@ -10641,7 +10641,7 @@ get_dllimport_decl (tree decl)
if (h)
return h->to;
*loc = h = GGC_NEW (struct tree_map);
*loc = h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = decl;
h->to = to = build_decl (DECL_SOURCE_LOCATION (decl),
@ -19504,7 +19504,7 @@ ix86_init_machine_status (void)
{
struct machine_function *f;
f = GGC_CNEW (struct machine_function);
f = ggc_alloc_cleared_machine_function ();
f->use_fast_prologue_epilogue_nregs = -1;
f->tls_descriptor_call_expanded_p = 0;
f->call_abi = ix86_abi;
@ -19532,8 +19532,7 @@ assign_386_stack_local (enum machine_mode mode, enum ix86_stack_slot n)
if (s->mode == mode && s->n == n)
return copy_rtx (s->rtl);
s = (struct stack_local_entry *)
ggc_alloc (sizeof (struct stack_local_entry));
s = ggc_alloc_stack_local_entry ();
s->n = n;
s->mode = mode;
s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);

View File

@ -576,7 +576,7 @@ i386_pe_record_external_function (tree decl, const char *name)
{
struct extern_list *p;
p = (struct extern_list *) ggc_alloc (sizeof *p);
p = ggc_alloc_extern_list ();
p->next = extern_head;
p->decl = decl;
p->name = name;
@ -617,7 +617,7 @@ i386_pe_maybe_record_exported_symbol (tree decl, const char *name, int is_data)
gcc_assert (TREE_PUBLIC (decl));
p = (struct export_list *) ggc_alloc (sizeof *p);
p = ggc_alloc_export_list ();
p->next = export_head;
p->name = name;
p->is_data = is_data;

View File

@ -5540,7 +5540,7 @@ void ia64_init_expanders (void)
static struct machine_function *
ia64_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
static enum attr_itanium_class ia64_safe_itanium_class (rtx);

View File

@ -1385,11 +1385,7 @@ iq2000_va_start (tree valist, rtx nextarg)
static struct machine_function *
iq2000_init_machine_status (void)
{
struct machine_function *f;
f = GGC_CNEW (struct machine_function);
return f;
return ggc_alloc_cleared_machine_function ();
}
/* Implement TARGET_HANDLE_OPTION. */

View File

@ -435,11 +435,7 @@ m32c_override_options (void)
static struct machine_function *
m32c_init_machine_status (void)
{
struct machine_function *machine;
machine =
(machine_function *) ggc_alloc_cleared (sizeof (machine_function));
return machine;
return ggc_alloc_cleared_machine_function ();
}
/* Implements INIT_EXPANDERS. We just set up to call the above

View File

@ -2369,11 +2369,7 @@ mep_register_move_cost (enum machine_mode mode, enum reg_class from, enum reg_cl
static struct machine_function *
mep_init_machine_status (void)
{
struct machine_function *f;
f = (struct machine_function *) ggc_alloc_cleared (sizeof (struct machine_function));
return f;
return ggc_alloc_cleared_machine_function ();
}
static rtx
@ -4234,7 +4230,7 @@ mep_note_pragma_flag (const char *funcname, int flag)
if (!*slot)
{
*slot = GGC_NEW (pragma_entry);
*slot = ggc_alloc_pragma_entry ();
(*slot)->flag = 0;
(*slot)->used = 0;
(*slot)->funcname = ggc_strdup (funcname);

View File

@ -1217,7 +1217,7 @@ mflip_mips16_use_mips16_p (tree decl)
if (!entry)
{
mips16_flipper = !mips16_flipper;
entry = GGC_NEW (struct mflip_mips16_entry);
entry = ggc_alloc_mflip_mips16_entry ();
entry->name = name;
entry->mips16_p = mips16_flipper ? !mips_base_mips16 : mips_base_mips16;
*slot = entry;
@ -5851,7 +5851,7 @@ mips16_local_alias (rtx func)
SYMBOL_REF_FLAGS (local) = SYMBOL_REF_FLAGS (func) | SYMBOL_FLAG_LOCAL;
/* Create a new structure to represent the mapping. */
alias = GGC_NEW (struct mips16_local_alias);
alias = ggc_alloc_mips16_local_alias ();
alias->func = func;
alias->local = local;
*slot = alias;
@ -15221,8 +15221,7 @@ mips_set_current_function (tree fndecl)
static struct machine_function *
mips_init_machine_status (void)
{
return ((struct machine_function *)
ggc_alloc_cleared (sizeof (struct machine_function)));
return ggc_alloc_cleared_machine_function ();
}
/* Return the processor associated with the given ISA level, or null

View File

@ -263,7 +263,7 @@ mmix_init_expanders (void)
static struct machine_function *
mmix_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* DATA_ALIGNMENT.

View File

@ -205,7 +205,7 @@ struct GTY(()) machine_function
static struct machine_function *
moxie_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}

View File

@ -558,7 +558,7 @@ pa_init_builtins (void)
static struct machine_function *
pa_init_machine_status (void)
{
return GGC_CNEW (machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* If FROM is a probable pointer register, mark TO as a probable
@ -5375,13 +5375,11 @@ get_deferred_plabel (rtx symbol)
tree id;
if (deferred_plabels == 0)
deferred_plabels = (struct deferred_plabel *)
ggc_alloc (sizeof (struct deferred_plabel));
deferred_plabels = ggc_alloc_deferred_plabel ();
else
deferred_plabels = (struct deferred_plabel *)
ggc_realloc (deferred_plabels,
((n_deferred_plabels + 1)
* sizeof (struct deferred_plabel)));
deferred_plabels = GGC_RESIZEVEC (struct deferred_plabel,
deferred_plabels,
n_deferred_plabels + 1);
i = n_deferred_plabels++;
deferred_plabels[i].internal_label = gen_label_rtx ();

View File

@ -12569,7 +12569,7 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0,
found = htab_find_slot (builtin_hash_table, &h, INSERT);
if (*found == NULL)
{
h2 = GGC_NEW (struct builtin_hash_struct);
h2 = ggc_alloc_builtin_hash_struct ();
*h2 = h;
*found = (void *)h2;
args = void_list_node;
@ -14465,7 +14465,7 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED)
static struct machine_function *
rs6000_init_machine_status (void)
{
return GGC_CNEW (machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* These macros test for integers and extract the low-order bits. */
@ -21194,7 +21194,7 @@ output_toc (FILE *file, rtx x, int labelno, enum machine_mode mode)
toc_hash_table = htab_create_ggc (1021, toc_hash_function,
toc_hash_eq, NULL);
h = GGC_NEW (struct toc_hash_struct);
h = ggc_alloc_toc_hash_struct ();
h->key = x;
h->key_mode = mode;
h->labelno = labelno;

View File

@ -1453,7 +1453,7 @@ s390_narrow_logical_operator (enum rtx_code code, rtx *memop, rtx *immop)
static struct machine_function *
s390_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* Change optimizations to be performed, depending on the

View File

@ -1186,7 +1186,7 @@ score3_output_external (FILE *file ATTRIBUTE_UNUSED,
if (score3_in_small_data_p (decl))
{
p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
p = ggc_alloc_extern_list ();
p->next = extern_head;
p->name = name;
p->size = int_size_in_bytes (TREE_TYPE (decl));

View File

@ -1174,7 +1174,7 @@ score7_output_external (FILE *file ATTRIBUTE_UNUSED,
if (score7_in_small_data_p (decl))
{
p = (struct extern_list *) ggc_alloc (sizeof (struct extern_list));
p = ggc_alloc_extern_list ();
p->next = extern_head;
p->name = name;
p->size = int_size_in_bytes (TREE_TYPE (decl));

View File

@ -9032,7 +9032,7 @@ sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED,
static struct machine_function *
sparc_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}
/* Locate some local-dynamic symbol still in use by this function

View File

@ -1281,7 +1281,7 @@ xtensa_expand_nonlocal_goto (rtx *operands)
static struct machine_function *
xtensa_init_machine_status (void)
{
return GGC_CNEW (struct machine_function);
return ggc_alloc_cleared_machine_function ();
}

View File

@ -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

View File

@ -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),

View File

@ -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),

View File

@ -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); \

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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))

View File

@ -1004,7 +1004,7 @@ dbxout_init (const char *input_file_name)
const char *mapped_name;
typevec_len = 100;
typevec = GGC_CNEWVEC (struct typeinfo, typevec_len);
typevec = ggc_alloc_cleared_vec_typeinfo (typevec_len);
/* stabstr_ob contains one string, which will be just fine with
1-byte alignment. */

View File

@ -149,20 +149,17 @@ option is a fragment of C code that calculates the length.
The second case is when a structure or a global variable contains a
pointer to an array, like this:
@smallexample
tree *
GTY ((length ("%h.regno_pointer_align_length"))) regno_decl;
struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
@end smallexample
In this case, @code{regno_decl} has been allocated by writing something like
In this case, @code{iter} has been allocated by writing something like
@smallexample
x->regno_decl =
ggc_alloc (x->regno_pointer_align_length * sizeof (tree));
x->iter = ggc_alloc_cleared_vec_gimple_omp_for_iter (collapse);
@end smallexample
and the @code{length} provides the length of the field.
and the @code{collapse} provides the length of the field.
This second use of @code{length} also works on global variables, like:
@verbatim
static GTY((length ("reg_base_value_size")))
rtx *reg_base_value;
static GTY((length("reg_known_value_size"))) rtx *reg_known_value;
@end verbatim
@findex skip
@ -353,6 +350,30 @@ of pointers. @code{reorder} functions can be expensive. When
possible, it is better to depend on properties of the data, like an ID
number or the hash of a string instead.
@findex variable_size
@item variable_size
The type machinery expects the types to be of constant size. When this
is not true, for example, with structs that have array fields or unions,
the type machinery cannot tell how many bytes need to be allocated at
each allocation. The @code{variable_size} is used to mark such types.
The type machinery then provides allocators that take a parameter
indicating an exact size of object being allocated.
For example,
@smallexample
struct GTY((variable_size)) sorted_fields_type @{
int len;
tree GTY((length ("%h.len"))) elts[1];
@};
@end smallexample
Then the objects of @code{struct sorted_fields_type} are allocated in GC
memory as follows:
@smallexample
field_vec = ggc_alloc_sorted_fields_type (size);
@end smallexample
@findex special
@item special ("@var{name}")

View File

@ -924,7 +924,7 @@ used to initialize the @code{machine} of that structure.
@code{struct machine_function} structures are expected to be freed by GC@.
Generally, any memory that they reference must be allocated by using
@code{ggc_alloc}, including the structure itself.
GC allocation, including the structure itself.
@end deftypevar
@node Storage Layout

View File

@ -816,7 +816,9 @@ dw2_force_const_mem (rtx x, bool is_public)
if (! indirect_pool)
/* We use strcmp, rather than just comparing pointers, so that the
sort order will not depend on the host system. */
indirect_pool = splay_tree_new_ggc (splay_tree_compare_strings);
indirect_pool = splay_tree_new_ggc (splay_tree_compare_strings,
ggc_alloc_splay_tree_str_tree_node_splay_tree_s,
ggc_alloc_splay_tree_str_tree_node_splay_tree_node_s);
gcc_assert (GET_CODE (x) == SYMBOL_REF);

View File

@ -722,7 +722,7 @@ dwarf_cfi_name (unsigned int cfi_opc)
static inline dw_cfi_ref
new_cfi (void)
{
dw_cfi_ref cfi = GGC_NEW (dw_cfi_node);
dw_cfi_ref cfi = ggc_alloc_dw_cfi_node ();
cfi->dw_cfi_next = NULL;
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0;
@ -1694,7 +1694,7 @@ queue_reg_save (const char *label, rtx reg, rtx sreg, HOST_WIDE_INT offset)
if (q == NULL)
{
q = GGC_NEW (struct queued_reg_save);
q = ggc_alloc_queued_reg_save ();
q->next = queued_reg_saves;
queued_reg_saves = q;
}
@ -4049,7 +4049,7 @@ void
dwarf2out_frame_init (void)
{
/* Allocate the initial hunk of the fde_table. */
fde_table = GGC_CNEWVEC (dw_fde_node, FDE_TABLE_INCREMENT);
fde_table = ggc_alloc_cleared_vec_dw_fde_node (FDE_TABLE_INCREMENT);
fde_table_allocated = FDE_TABLE_INCREMENT;
fde_table_in_use = 0;
@ -4605,7 +4605,7 @@ static inline dw_loc_descr_ref
new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
unsigned HOST_WIDE_INT oprnd2)
{
dw_loc_descr_ref descr = GGC_CNEW (dw_loc_descr_node);
dw_loc_descr_ref descr = ggc_alloc_cleared_dw_loc_descr_node ();
descr->dw_loc_opc = op;
descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
@ -7058,8 +7058,7 @@ find_AT_string (const char *str)
htab_hash_string (str), INSERT);
if (*slot == NULL)
{
node = (struct indirect_string_node *)
ggc_alloc_cleared (sizeof (struct indirect_string_node));
node = ggc_alloc_cleared_indirect_string_node ();
node->str = ggc_strdup (str);
*slot = node;
}
@ -7684,7 +7683,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child)
static inline dw_die_ref
new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t)
{
dw_die_ref die = GGC_CNEW (die_node);
dw_die_ref die = ggc_alloc_cleared_die_node ();
die->die_tag = tag_value;
@ -7694,7 +7693,7 @@ new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t)
{
limbo_die_node *limbo_node;
limbo_node = GGC_CNEW (limbo_die_node);
limbo_node = ggc_alloc_cleared_limbo_die_node ();
limbo_node->die = die;
limbo_node->created_for = t;
limbo_node->next = limbo_die_list;
@ -7957,7 +7956,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
slot = htab_find_slot_with_hash (decl_loc_table, decl, decl_id, INSERT);
if (*slot == NULL)
{
temp = GGC_CNEW (var_loc_list);
temp = ggc_alloc_cleared_var_loc_list ();
temp->decl_id = decl_id;
*slot = temp;
}
@ -8047,7 +8046,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
memset (loc, '\0', sizeof (*loc));
}
else
loc = GGC_CNEW (struct var_loc_node);
loc = ggc_alloc_cleared_var_loc_node ();
if (bitsize == -1 || piece_loc == NULL)
loc->loc = construct_piece_list (loc_note, bitpos, bitsize);
else
@ -8064,7 +8063,7 @@ add_var_loc_to_decl (tree decl, rtx loc_note, const char *label)
}
else
{
loc = GGC_CNEW (struct var_loc_node);
loc = ggc_alloc_cleared_var_loc_node ();
temp->first = loc;
temp->last = loc;
loc->loc = construct_piece_list (loc_note, bitpos, bitsize);
@ -9554,7 +9553,7 @@ clone_die (dw_die_ref die)
dw_attr_ref a;
unsigned ix;
clone = GGC_CNEW (die_node);
clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
@ -9595,7 +9594,7 @@ clone_as_declaration (dw_die_ref die)
if (decl != NULL)
return clone_die (decl);
clone = GGC_CNEW (die_node);
clone = ggc_alloc_cleared_die_node ();
clone->die_tag = die->die_tag;
for (ix = 0; VEC_iterate (dw_attr_node, die->die_attr, ix, a); ix++)
@ -9814,7 +9813,7 @@ break_out_comdat_types (dw_die_ref die)
unit = new_die (DW_TAG_type_unit, NULL, NULL);
add_AT_unsigned (unit, DW_AT_language,
get_AT_unsigned (comp_unit_die, DW_AT_language));
type_node = GGC_CNEW (comdat_type_node);
type_node = ggc_alloc_cleared_comdat_type_node ();
type_node->root_die = unit;
type_node->next = comdat_type_list;
comdat_type_list = type_node;
@ -10612,7 +10611,7 @@ static inline dw_loc_list_ref
new_loc_list (dw_loc_descr_ref expr, const char *begin, const char *end,
const char *section)
{
dw_loc_list_ref retlist = GGC_CNEW (dw_loc_list_node);
dw_loc_list_ref retlist = ggc_alloc_cleared_dw_loc_list_node ();
retlist->begin = begin;
retlist->end = end;
@ -14133,7 +14132,8 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
if (SCALAR_FLOAT_MODE_P (mode))
{
unsigned int length = GET_MODE_SIZE (mode);
unsigned char *array = GGC_NEWVEC (unsigned char, length);
unsigned char *array
= (unsigned char*) ggc_alloc_atomic (length);
insert_float (rtl, array);
loc_result->dw_loc_oprnd2.val_class = dw_val_class_vec;
@ -14158,7 +14158,8 @@ loc_descriptor (rtx rtl, enum machine_mode mode,
{
unsigned int elt_size = GET_MODE_UNIT_SIZE (GET_MODE (rtl));
unsigned int length = CONST_VECTOR_NUNITS (rtl);
unsigned char *array = GGC_NEWVEC (unsigned char, length * elt_size);
unsigned char *array = (unsigned char *)
ggc_alloc_atomic (length * elt_size);
unsigned int i;
unsigned char *p;
@ -14642,12 +14643,12 @@ add_loc_descr_to_each (dw_loc_list_ref list, dw_loc_descr_ref ref)
list = list->dw_loc_next;
while (list)
{
copy = GGC_CNEW (dw_loc_descr_node);
copy = ggc_alloc_dw_loc_descr_node ();
memcpy (copy, ref, sizeof (dw_loc_descr_node));
add_loc_descr (&list->expr, copy);
while (copy->dw_loc_next)
{
dw_loc_descr_ref new_copy = GGC_CNEW (dw_loc_descr_node);
dw_loc_descr_ref new_copy = ggc_alloc_dw_loc_descr_node ();
memcpy (new_copy, copy->dw_loc_next, sizeof (dw_loc_descr_node));
copy->dw_loc_next = new_copy;
copy = new_copy;
@ -15803,7 +15804,7 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
if (SCALAR_FLOAT_MODE_P (mode))
{
unsigned int length = GET_MODE_SIZE (mode);
unsigned char *array = GGC_NEWVEC (unsigned char, length);
unsigned char *array = (unsigned char *) ggc_alloc_atomic (length);
insert_float (rtl, array);
add_AT_vec (die, DW_AT_const_value, length / 4, 4, array);
@ -15819,7 +15820,8 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
enum machine_mode mode = GET_MODE (rtl);
unsigned int elt_size = GET_MODE_UNIT_SIZE (mode);
unsigned int length = CONST_VECTOR_NUNITS (rtl);
unsigned char *array = GGC_NEWVEC (unsigned char, length * elt_size);
unsigned char *array = (unsigned char *) ggc_alloc_atomic
(length * elt_size);
unsigned int i;
unsigned char *p;
@ -16569,7 +16571,8 @@ tree_add_const_value_attribute (dw_die_ref die, tree t)
HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (init));
if (size > 0 && (int) size == size)
{
unsigned char *array = GGC_CNEWVEC (unsigned char, size);
unsigned char *array = (unsigned char *)
ggc_alloc_cleared_atomic (size);
if (native_encode_initializer (init, array, size))
{
@ -16757,7 +16760,7 @@ add_comp_dir_attribute (dw_die_ref die)
int wdlen;
wdlen = strlen (wd);
wd1 = GGC_NEWVEC (char, wdlen + 2);
wd1 = (char *) ggc_alloc_atomic (wdlen + 2);
strcpy (wd1, wd);
wd1 [wdlen] = DIR_SEPARATOR;
wd1 [wdlen + 1] = 0;
@ -17207,7 +17210,7 @@ add_name_and_src_coords_attributes (dw_die_ref die, tree decl)
{
limbo_die_node *asm_name;
asm_name = GGC_CNEW (limbo_die_node);
asm_name = ggc_alloc_cleared_limbo_die_node ();
asm_name->die = die;
asm_name->created_for = decl;
asm_name->next = deferred_asm_name;
@ -20678,7 +20681,7 @@ lookup_filename (const char *file_name)
if (*slot)
return (struct dwarf_file_data *) *slot;
created = GGC_NEW (struct dwarf_file_data);
created = ggc_alloc_dwarf_file_data ();
created->filename = file_name;
created->emitted_number = 0;
*slot = created;
@ -20834,7 +20837,7 @@ vcall_insn_table_eq (const void *x, const void *y)
static void
store_vcall_insn (unsigned int vtable_slot, int insn_uid)
{
struct vcall_insn *item = GGC_NEW (struct vcall_insn);
struct vcall_insn *item = ggc_alloc_vcall_insn ();
struct vcall_insn **slot;
gcc_assert (item);
@ -21192,13 +21195,15 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
decl_scope_table = VEC_alloc (tree, gc, 256);
/* Allocate the initial hunk of the abbrev_die_table. */
abbrev_die_table = GGC_CNEWVEC (dw_die_ref, ABBREV_DIE_TABLE_INCREMENT);
abbrev_die_table = ggc_alloc_cleared_vec_dw_die_ref
(ABBREV_DIE_TABLE_INCREMENT);
abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT;
/* Zero-th entry is allocated, but unused. */
abbrev_die_table_in_use = 1;
/* Allocate the initial hunk of the line_info_table. */
line_info_table = GGC_CNEWVEC (dw_line_info_entry, LINE_INFO_TABLE_INCREMENT);
line_info_table = ggc_alloc_cleared_vec_dw_line_info_entry
(LINE_INFO_TABLE_INCREMENT);
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
/* Zero-th entry is allocated, but unused. */

View File

@ -341,7 +341,7 @@ get_mem_attrs (alias_set_type alias, tree expr, rtx offset, rtx size,
slot = htab_find_slot (mem_attrs_htab, &attrs, INSERT);
if (*slot == 0)
{
*slot = ggc_alloc (sizeof (mem_attrs));
*slot = ggc_alloc_mem_attrs ();
memcpy (*slot, &attrs, sizeof (mem_attrs));
}
@ -390,7 +390,7 @@ get_reg_attrs (tree decl, int offset)
slot = htab_find_slot (reg_attrs_htab, &attrs, INSERT);
if (*slot == 0)
{
*slot = ggc_alloc (sizeof (reg_attrs));
*slot = ggc_alloc_reg_attrs ();
memcpy (*slot, &attrs, sizeof (reg_attrs));
}
@ -5240,7 +5240,7 @@ start_sequence (void)
free_sequence_stack = tem->next;
}
else
tem = GGC_NEW (struct sequence_stack);
tem = ggc_alloc_sequence_stack ();
tem->next = seq_stack;
tem->first = get_insns ();
@ -5555,8 +5555,7 @@ init_emit (void)
crtl->emit.regno_pointer_align
= XCNEWVEC (unsigned char, crtl->emit.regno_pointer_align_length);
regno_reg_rtx
= GGC_NEWVEC (rtx, crtl->emit.regno_pointer_align_length);
regno_reg_rtx = ggc_alloc_vec_rtx (crtl->emit.regno_pointer_align_length);
/* Put copies of all the hard registers into regno_reg_rtx. */
memcpy (regno_reg_rtx,

View File

@ -329,7 +329,7 @@ init_eh (void)
void
init_eh_for_function (void)
{
cfun->eh = GGC_CNEW (struct eh_status);
cfun->eh = ggc_alloc_cleared_eh_status ();
/* Make sure zero'th entries are used. */
VEC_safe_push (eh_region, gc, cfun->eh->region_array, NULL);
@ -350,7 +350,7 @@ gen_eh_region (enum eh_region_type type, eh_region outer)
#endif
/* Insert a new blank region as a leaf in the tree. */
new_eh = GGC_CNEW (struct eh_region_d);
new_eh = ggc_alloc_cleared_eh_region_d ();
new_eh->type = type;
new_eh->outer = outer;
if (outer)
@ -407,7 +407,7 @@ gen_eh_region_catch (eh_region t, tree type_or_list)
add_type_for_runtime (TREE_VALUE (type_node));
}
c = GGC_CNEW (struct eh_catch_d);
c = ggc_alloc_cleared_eh_catch_d ();
c->type_list = type_list;
l = t->u.eh_try.last_catch;
c->prev_catch = l;
@ -441,7 +441,7 @@ gen_eh_region_must_not_throw (eh_region outer)
eh_landing_pad
gen_eh_landing_pad (eh_region region)
{
eh_landing_pad lp = GGC_CNEW (struct eh_landing_pad_d);
eh_landing_pad lp = ggc_alloc_cleared_eh_landing_pad_d ();
lp->next_lp = region->landing_pads;
lp->region = region;
@ -2368,7 +2368,7 @@ add_call_site (rtx landing_pad, int action, int section)
{
call_site_record record;
record = GGC_NEW (struct call_site_record_d);
record = ggc_alloc_call_site_record_d ();
record->landing_pad = landing_pad;
record->action = action;

View File

@ -1,3 +1,17 @@
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* trans-types.c (gfc_get_nodesc_array_type): Use typed GC
allocation.
(gfc_get_array_type_bounds): Likewise.
* trans-decl.c (gfc_allocate_lang_decl): Likewise.
(gfc_find_module): Likewise.
* f95-lang.c (pushlevel): Likewise.
* trans.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
2010-06-08 Tobias Burnus <burnus@net-b.de>
PR fortran/44446

View File

@ -350,8 +350,7 @@ getdecls (void)
void
pushlevel (int ignore ATTRIBUTE_UNUSED)
{
struct binding_level *newlevel
= (struct binding_level *) ggc_alloc (sizeof (struct binding_level));
struct binding_level *newlevel = ggc_alloc_binding_level ();
*newlevel = clear_binding_level;

View File

@ -612,8 +612,8 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
void
gfc_allocate_lang_decl (tree decl)
{
DECL_LANG_SPECIFIC (decl) = (struct lang_decl *)
ggc_alloc_cleared (sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (decl) = ggc_alloc_cleared_lang_decl(sizeof
(struct lang_decl));
}
/* Remember a symbol to generate initialization/cleanup code at function
@ -3410,7 +3410,7 @@ gfc_find_module (const char *name)
htab_hash_string (name), INSERT);
if (*slot == NULL)
{
struct module_htab_entry *entry = GGC_CNEW (struct module_htab_entry);
struct module_htab_entry *entry = ggc_alloc_cleared_module_htab_entry ();
entry->name = gfc_get_string (name);
entry->decls = htab_create_ggc (10, module_htab_decls_hash,

View File

@ -1390,8 +1390,8 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
type = make_node (ARRAY_TYPE);
GFC_ARRAY_TYPE_P (type) = 1;
TYPE_LANG_SPECIFIC (type) = (struct lang_type *)
ggc_alloc_cleared (sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (type)
= ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
known_stride = (packed != PACKED_NO);
known_offset = 1;
@ -1631,8 +1631,8 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
TYPE_NAME (fat_type) = get_identifier (name);
GFC_DESCRIPTOR_TYPE_P (fat_type) = 1;
TYPE_LANG_SPECIFIC (fat_type) = (struct lang_type *)
ggc_alloc_cleared (sizeof (struct lang_type));
TYPE_LANG_SPECIFIC (fat_type)
= ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
GFC_TYPE_ARRAY_RANK (fat_type) = dimen;
GFC_TYPE_ARRAY_DTYPE (fat_type) = NULL_TREE;

View File

@ -630,7 +630,10 @@ enum gfc_array_kind
};
/* Array types only. */
struct GTY(()) lang_type {
/* FIXME: the variable_size annotation here is needed because these types are
variable-sized in some other frontends. Due to gengtype deficiency the GTY
options of such types have to agree across all frontends. */
struct GTY((variable_size)) lang_type {
int rank;
enum gfc_array_kind akind;
tree lbound[GFC_MAX_DIMENSIONS];
@ -644,7 +647,7 @@ struct GTY(()) lang_type {
tree base_decl[2];
};
struct GTY(()) lang_decl {
struct GTY((variable_size)) lang_decl {
/* Dummy variables. */
tree saved_descriptor;
/* Assigned integer nodes. Stringlength is the IO format string's length.

View File

@ -340,7 +340,7 @@ try_fit_stack_local (HOST_WIDE_INT start, HOST_WIDE_INT length,
static void
add_frame_space (HOST_WIDE_INT start, HOST_WIDE_INT end)
{
struct frame_space *space = GGC_NEW (struct frame_space);
struct frame_space *space = ggc_alloc_frame_space ();
space->next = crtl->frame_space_list;
crtl->frame_space_list = space;
space->start = start;
@ -683,7 +683,7 @@ static void
insert_temp_slot_address (rtx address, struct temp_slot *temp_slot)
{
void **slot;
struct temp_slot_address_entry *t = GGC_NEW (struct temp_slot_address_entry);
struct temp_slot_address_entry *t = ggc_alloc_temp_slot_address_entry ();
t->address = address;
t->temp_slot = temp_slot;
t->hash = temp_slot_address_compute_hash (t);
@ -835,7 +835,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
if (best_p->size - rounded_size >= alignment)
{
p = GGC_NEW (struct temp_slot);
p = ggc_alloc_temp_slot ();
p->in_use = p->addr_taken = 0;
p->size = best_p->size - rounded_size;
p->base_offset = best_p->base_offset + rounded_size;
@ -859,7 +859,7 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
{
HOST_WIDE_INT frame_offset_old = frame_offset;
p = GGC_NEW (struct temp_slot);
p = ggc_alloc_temp_slot ();
/* We are passing an explicit alignment request to assign_stack_local.
One side effect of that is assign_stack_local will not round SIZE
@ -4196,7 +4196,7 @@ allocate_struct_function (tree fndecl, bool abstract_p)
tree result;
tree fntype = fndecl ? TREE_TYPE (fndecl) : NULL_TREE;
cfun = GGC_CNEW (struct function);
cfun = ggc_alloc_cleared_function ();
init_eh_for_function ();
@ -5623,8 +5623,7 @@ types_used_by_var_decl_insert (tree type, tree var_decl)
if (*slot == NULL)
{
struct types_used_by_vars_entry *entry;
entry = (struct types_used_by_vars_entry*) ggc_alloc
(sizeof (struct types_used_by_vars_entry));
entry = ggc_alloc_types_used_by_vars_entry ();
entry->type = type;
entry->var_decl = var_decl;
*slot = entry;

View File

@ -1895,9 +1895,8 @@ static void output_escaped_param (struct walk_type_data *d,
const char *, const char *);
static void output_mangled_typename (outf_p, const_type_p);
static void walk_type (type_p t, struct walk_type_data *d);
static void write_func_for_structure
(type_p orig_s, type_p s, type_p * param,
const struct write_types_data *wtd);
static void write_func_for_structure (type_p orig_s, type_p s, type_p * param,
const struct write_types_data *wtd);
static void write_types_process_field
(type_p f, const struct walk_type_data *d);
static void write_types (outf_p output_header,
@ -2088,6 +2087,8 @@ walk_type (type_p t, struct walk_type_data *d)
;
else if (strcmp (oo->name, "reorder") == 0)
;
else if (strcmp (oo->name, "variable_size") == 0)
;
else
error_at_line (d->line, "unknown option `%s'\n", oo->name);
@ -3026,6 +3027,20 @@ write_local (outf_p output_header, type_p structures, type_p param_structs)
}
}
/* Nonzero if S is a type for which typed GC allocators should be output. */
#define USED_BY_TYPED_GC_P(s) \
(((s->kind == TYPE_POINTER) \
&& ((s->u.p->gc_used == GC_POINTED_TO) \
|| (s->u.p->gc_used == GC_USED))) \
|| (UNION_OR_STRUCT_P (s) && \
(((s)->gc_used == GC_POINTED_TO) \
|| ((s)->gc_used == GC_MAYBE_POINTED_TO \
&& s->u.s.line.file != NULL) \
|| ((s)->gc_used == GC_USED \
&& strncmp (s->u.s.tag, "anonymous", strlen ("anonymous"))))))
/* Write out the 'enum' definition for gt_types_enum. */
static void
@ -3038,23 +3053,18 @@ write_enum_defn (type_p structures, type_p param_structs)
oprintf (header_file, "\n/* Enumeration of types known. */\n");
oprintf (header_file, "enum gt_types_enum {\n");
for (s = structures; s; s = s->next)
if (s->gc_used == GC_POINTED_TO
|| s->gc_used == GC_MAYBE_POINTED_TO)
if (USED_BY_TYPED_GC_P (s))
{
if (s->gc_used == GC_MAYBE_POINTED_TO
&& s->u.s.line.file == NULL)
continue;
oprintf (header_file, " gt_ggc_e_");
output_mangled_typename (header_file, s);
oprintf (header_file, ", \n");
oprintf (header_file, ",\n");
}
for (s = param_structs; s; s = s->next)
if (s->gc_used == GC_POINTED_TO)
{
oprintf (header_file, " gt_e_");
output_mangled_typename (header_file, s);
oprintf (header_file, ", \n");
oprintf (header_file, ",\n");
}
oprintf (header_file, " gt_types_enum_last\n");
oprintf (header_file, "};\n");
@ -3701,6 +3711,213 @@ note_def_vec_alloc (const char *type, const char *astrat, struct fileloc *pos)
do_typedef (astratname, new_structure (astratname, 0, pos, field, 0), pos);
}
/* Returns the specifier keyword for a string or union type S, empty string
otherwise. */
static const char *
get_type_specifier (const type_p s)
{
if (s->kind == TYPE_STRUCT || s->kind == TYPE_LANG_STRUCT)
return "struct ";
if (s->kind == TYPE_UNION)
return "union ";
return "";
}
/* TRUE if type S has the GTY variable_size annotation. */
static bool
variable_size_p (const type_p s)
{
options_p o;
for (o = s->u.s.opt; o; o = o->next)
if (strcmp (o->name, "variable_size") == 0)
return true;
return false;
}
enum alloc_quantity { single, vector };
enum alloc_zone { any_zone, specific_zone };
/* Writes one typed allocator definition for type identifier TYPE_NAME with
optional type specifier TYPE_SPECIFIER. The allocator name will contain
ALLOCATOR_TYPE. If VARIABLE_SIZE is true, the allocator will have an extra
parameter specifying number of bytes to allocate. If QUANTITY is set to
VECTOR, a vector allocator will be output, if ZONE is set to SPECIFIC_ZONE,
the allocator will be zone-specific. */
static void
write_typed_alloc_def (bool variable_size, const char * type_specifier,
const char * type_name, const char * allocator_type,
enum alloc_quantity quantity, enum alloc_zone zone)
{
bool two_args = variable_size && (quantity == vector);
bool third_arg = ((zone == specific_zone)
&& (variable_size || (quantity == vector)));
oprintf (header_file, "#define ggc_alloc_%s%s",allocator_type, type_name);
oprintf (header_file, "(%s%s%s%s%s) ",
(variable_size ? "SIZE" : ""),
(two_args ? ", " : ""),
(quantity == vector) ? "n" : "",
(third_arg ? ", " : ""), (zone == specific_zone) ? "z" : "");
oprintf (header_file, "((%s%s *)", type_specifier, type_name);
oprintf (header_file, "(ggc_internal_%salloc_stat (", allocator_type);
if (zone == specific_zone)
oprintf (header_file, "z, ");
if (variable_size)
oprintf (header_file, "SIZE");
else
oprintf (header_file, "sizeof (%s%s)", type_specifier, type_name);
if (quantity == vector)
oprintf (header_file, ", n");
oprintf (header_file, " MEM_STAT_INFO)))\n");
}
/* Writes a typed allocator definition for a struct or union S. */
static void
write_typed_struct_alloc_def (const type_p s, const char * allocator_type,
enum alloc_quantity quantity,
enum alloc_zone zone)
{
write_typed_alloc_def (variable_size_p (s), get_type_specifier (s),
s->u.s.tag, allocator_type, quantity, zone);
}
/* Writes a typed allocator definition for a typedef P. */
static void
write_typed_typedef_alloc_def (const pair_p p, const char * allocator_type,
enum alloc_quantity quantity,
enum alloc_zone zone)
{
write_typed_alloc_def (variable_size_p (p->type), "", p->name,
allocator_type, quantity, zone);
}
/* Writes typed allocator definitions for the types in STRUCTURES and
TYPEDEFS that are used by GC. */
static void
write_typed_alloc_defns (const type_p structures, const pair_p typedefs)
{
type_p s;
pair_p p;
oprintf (header_file,
"\n/* Allocators for known structs and unions. */\n\n");
for (s = structures; s; s = s->next)
{
if (!USED_BY_TYPED_GC_P (s))
continue;
write_typed_struct_alloc_def (s, "", single, any_zone);
write_typed_struct_alloc_def (s, "cleared_", single, any_zone);
write_typed_struct_alloc_def (s, "vec_", vector, any_zone);
write_typed_struct_alloc_def (s, "cleared_vec_", vector, any_zone);
write_typed_struct_alloc_def (s, "zone_", single, specific_zone);
write_typed_struct_alloc_def (s, "zone_cleared_", single,
specific_zone);
write_typed_struct_alloc_def (s, "zone_vec_", vector, specific_zone);
write_typed_struct_alloc_def (s, "zone_cleared_vec_", vector,
specific_zone);
}
oprintf (header_file, "\n/* Allocators for known typedefs. */\n");
for (p = typedefs; p; p = p->next)
{
s = p->type;
if (!USED_BY_TYPED_GC_P (s) || (strcmp (p->name, s->u.s.tag) == 0))
continue;
write_typed_typedef_alloc_def (p, "", single, any_zone);
write_typed_typedef_alloc_def (p, "cleared_", single, any_zone);
write_typed_typedef_alloc_def (p, "vec_", vector, any_zone);
write_typed_typedef_alloc_def (p, "cleared_vec_", vector, any_zone);
write_typed_typedef_alloc_def (p, "zone_", single, specific_zone);
write_typed_typedef_alloc_def (p, "zone_cleared_", single,
specific_zone);
write_typed_typedef_alloc_def (p, "zone_cleared_vec_", vector,
specific_zone);
}
}
/* Prints not-as-ugly version of a typename of T to OF. Trades the uniquness
guaranteee for somewhat increased readability. If name conflicts do happen,
this funcion will have to be adjusted to be more like
output_mangled_typename. */
static void
output_typename (outf_p of, const_type_p t)
{
switch (t->kind)
{
case TYPE_STRING:
oprintf (of, "str");
break;
case TYPE_SCALAR:
oprintf (of, "scalar");
break;
case TYPE_POINTER:
output_typename (of, t->u.p);
break;
case TYPE_STRUCT:
case TYPE_UNION:
case TYPE_LANG_STRUCT:
oprintf (of, "%s", t->u.s.tag);
break;
case TYPE_PARAM_STRUCT:
{
int i;
for (i = 0; i < NUM_PARAM; i++)
if (t->u.param_struct.param[i] != NULL) {
output_typename (of, t->u.param_struct.param[i]);
oprintf (of, "_");
}
output_typename (of, t->u.param_struct.stru);
break;
}
default:
gcc_unreachable();
}
}
/* Writes a typed GC allocator for type S that is suitable as a callback for
the splay tree implementation in libiberty. */
static void
write_splay_tree_allocator_def (const_type_p s)
{
outf_p of = get_output_file_for_structure(s, NULL);
oprintf (of, "void * ggc_alloc_splay_tree_");
output_typename (of, s);
oprintf (of, " (int sz, void * nl)\n");
oprintf (of, "{\n");
oprintf (of, " return ggc_splay_alloc (");
oprintf (of, "gt_e_");
output_mangled_typename (of, s);
oprintf (of, ", sz, nl);\n");
oprintf (of, "}\n\n");
}
/* Writes typed GC allocators for PARAM_STRUCTS that are suitable as callbacks
for the splay tree implementation in libiberty. */
static void
write_splay_tree_allocators (const_type_p param_structs)
{
const_type_p s;
oprintf (header_file, "\n/* Splay tree callback allocators. */\n");
for (s = param_structs; s; s = s->next)
if (s->gc_used == GC_POINTED_TO)
{
oprintf (header_file, "extern void * ggc_alloc_splay_tree_");
output_typename (header_file, s);
oprintf (header_file, " (int, void *);\n");
write_splay_tree_allocator_def (s);
}
}
static void dump_pair (int indent, pair_p p);
static void dump_type (int indent, type_p p);
static void dump_type_list (int indent, type_p p);
@ -4021,6 +4238,7 @@ main (int argc, char **argv)
open_base_files ();
write_enum_defn (structures, param_structs);
write_typed_alloc_defns (structures, typedefs);
output_header = plugin_output ? plugin_output : header_file;
write_types (output_header, structures, param_structs, &ggc_wtd);
if (plugin_files == NULL)
@ -4028,6 +4246,7 @@ main (int argc, char **argv)
write_types (header_file, structures, param_structs, &pch_wtd);
write_local (header_file, structures, param_structs);
}
write_splay_tree_allocators (param_structs);
write_roots (variables, plugin_files == NULL);
write_rtx_next ();
close_output_files ();

View File

@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "hashtab.h"
#include "ggc.h"
#include "ggc-internal.h"
#include "toplev.h"
#include "params.h"
#include "hosthooks.h"
@ -193,9 +194,9 @@ ggc_mark_roots (void)
/* Allocate a block of memory, then clear it. */
void *
ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
ggc_internal_cleared_alloc_stat (size_t size MEM_STAT_DECL)
{
void *buf = ggc_alloc_stat (size PASS_MEM_STAT);
void *buf = ggc_internal_alloc_stat (size PASS_MEM_STAT);
memset (buf, 0, size);
return buf;
}
@ -208,7 +209,7 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
size_t old_size;
if (x == NULL)
return ggc_alloc_stat (size PASS_MEM_STAT);
return ggc_internal_alloc_stat (size PASS_MEM_STAT);
old_size = ggc_get_size (x);
@ -230,7 +231,7 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
return x;
}
r = ggc_alloc_stat (size PASS_MEM_STAT);
r = ggc_internal_alloc_stat (size PASS_MEM_STAT);
/* Since ggc_get_size returns the size of the pool, not the size of the
individually allocated object, we'd access parts of the old object
@ -246,19 +247,30 @@ ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
return r;
}
/* Like ggc_alloc_cleared, but performs a multiplication. */
void *
ggc_calloc (size_t s1, size_t s2)
ggc_cleared_alloc_htab_ignore_args (size_t c ATTRIBUTE_UNUSED,
size_t n ATTRIBUTE_UNUSED)
{
return ggc_alloc_cleared (s1 * s2);
gcc_assert (c * n == sizeof (struct htab));
return ggc_alloc_cleared_htab ();
}
/* TODO: once we actually use type information in GGC, create a new tag
gt_gcc_ptr_array and use it for pointer arrays. */
void *
ggc_cleared_alloc_ptr_array_two_args (size_t c, size_t n)
{
gcc_assert (sizeof (PTR *) == n);
return ggc_internal_cleared_vec_alloc (sizeof (PTR *), c);
}
/* These are for splay_tree_new_ggc. */
void *
ggc_splay_alloc (int sz, void *nl)
ggc_splay_alloc (enum gt_types_enum obj_type ATTRIBUTE_UNUSED, int sz,
void *nl)
{
gcc_assert (!nl);
return ggc_alloc (sz);
return ggc_internal_alloc (sz);
}
void
@ -516,7 +528,7 @@ gt_pch_save (FILE *f)
/* Prepare the objects for writing, determine addresses and such. */
state.f = f;
state.d = init_ggc_pch();
state.d = init_ggc_pch ();
state.count = 0;
htab_traverse (saving_htab, call_count, &state);
@ -825,7 +837,7 @@ ggc_min_heapsize_heuristic (void)
the limit, whichever is larger. If GCC does hit the data limit,
compilation will fail, so this tries to be conservative. */
limit_kbytes = MAX (0, limit_kbytes - MAX (limit_kbytes / 4, 20 * 1024));
limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic());
limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic ());
phys_kbytes = MIN (phys_kbytes, limit_kbytes);
phys_kbytes = MAX (phys_kbytes, 4 * 1024);
@ -839,8 +851,8 @@ void
init_ggc_heuristics (void)
{
#if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT
set_param_value ("ggc-min-expand", ggc_min_expand_heuristic());
set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic());
set_param_value ("ggc-min-expand", ggc_min_expand_heuristic ());
set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic ());
#endif
}

121
gcc/ggc-internal.h Normal file
View File

@ -0,0 +1,121 @@
/* Garbage collection for the GNU compiler. Internal definitions
for ggc-*.c and stringpool.c.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GGC_INTERNAL_H
#define GCC_GGC_INTERNAL_H
#include "ggc.h"
/* Call ggc_set_mark on all the roots. */
extern void ggc_mark_roots (void);
/* Stringpool. */
/* Mark the entries in the string pool. */
extern void ggc_mark_stringpool (void);
/* Purge the entries in the string pool. */
extern void ggc_purge_stringpool (void);
/* Save and restore the string pool entries for PCH. */
extern void gt_pch_save_stringpool (void);
extern void gt_pch_fixup_stringpool (void);
extern void gt_pch_restore_stringpool (void);
/* PCH and GGC handling for strings, mostly trivial. */
extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *);
/* PCH. */
struct ggc_pch_data;
/* Return a new ggc_pch_data structure. */
extern struct ggc_pch_data *init_ggc_pch (void);
/* The second parameter and third parameters give the address and size
of an object. Update the ggc_pch_data structure with as much of
that information as is necessary. The bool argument should be true
if the object is a string. */
extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool,
enum gt_types_enum);
/* Return the total size of the data to be written to hold all
the objects previously passed to ggc_pch_count_object. */
extern size_t ggc_pch_total_size (struct ggc_pch_data *);
/* The objects, when read, will most likely be at the address
in the second parameter. */
extern void ggc_pch_this_base (struct ggc_pch_data *, void *);
/* Assuming that the objects really do end up at the address
passed to ggc_pch_this_base, return the address of this object.
The bool argument should be true if the object is a string. */
extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool,
enum gt_types_enum);
/* Write out any initial information required. */
extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *);
/* Write out this object, including any padding. The last argument should be
true if the object is a string. */
extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *,
void *, size_t, bool);
/* All objects have been written, write out any final information
required. */
extern void ggc_pch_finish (struct ggc_pch_data *, FILE *);
/* A PCH file has just been read in at the address specified second
parameter. Set up the GC implementation for the new objects. */
extern void ggc_pch_read (FILE *, void *);
/* Allocation and collection. */
/* When set, ggc_collect will do collection. */
extern bool ggc_force_collect;
extern void ggc_record_overhead (size_t, size_t, void * MEM_STAT_DECL);
extern void ggc_free_overhead (void *);
extern void ggc_prune_overhead_list (void);
/* Return the number of bytes allocated at the indicated address. */
extern size_t ggc_get_size (const void *);
/* Statistics. */
/* This structure contains the statistics common to all collectors.
Particular collectors can extend this structure. */
typedef struct ggc_statistics
{
/* At present, we don't really gather any interesting statistics. */
int unused;
} ggc_statistics;
/* Used by the various collectors to gather and print statistics that
do not depend on the collector in use. */
extern void ggc_print_common_statistics (FILE *, ggc_statistics *);
#endif

View File

@ -1,5 +1,5 @@
/* Null garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007
Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -40,13 +40,13 @@ ggc_alloc_typed_stat (enum gt_types_enum ARG_UNUSED (gte), size_t size
}
void *
ggc_alloc_stat (size_t size MEM_STAT_DECL)
ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
return xmalloc (size);
}
void *
ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
ggc_internal_cleared_alloc_stat (size_t size MEM_STAT_DECL)
{
return xcalloc (size, 1);
}
@ -62,3 +62,12 @@ ggc_free (void *p)
{
free (p);
}
struct alloc_zone
{
int dummy;
};
struct alloc_zone rtl_zone;
struct alloc_zone tree_zone;
struct alloc_zone tree_id_zone;

View File

@ -1,6 +1,6 @@
/* "Bag-of-pages" garbage collector for the GNU compiler.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009,
2010 Free Software Foundation, Inc.
This file is part of GCC.
@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
#include "ggc-internal.h"
#include "timevar.h"
#include "params.h"
#include "tree-flow.h"
@ -437,9 +438,9 @@ static struct globals
#ifdef GATHER_STATISTICS
struct
{
/* Total memory allocated with ggc_alloc. */
/* Total GC-allocated memory. */
unsigned long long total_allocated;
/* Total overhead for memory to be allocated with ggc_alloc. */
/* Total overhead for GC-allocated memory. */
unsigned long long total_overhead;
/* Total allocations and overhead for sizes less than 32, 64 and 128.
@ -689,7 +690,7 @@ alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size)
G.bytes_mapped += size;
/* Pretend we don't have access to the allocated pages. We'll enable
access to smaller pieces of the area in ggc_alloc. Discard the
access to smaller pieces of the area in ggc_internal_alloc. Discard the
handle to avoid handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (page, size));
@ -1074,13 +1075,13 @@ void *
ggc_alloc_typed_stat (enum gt_types_enum type ATTRIBUTE_UNUSED, size_t size
MEM_STAT_DECL)
{
return ggc_alloc_stat (size PASS_MEM_STAT);
return ggc_internal_alloc_stat (size PASS_MEM_STAT);
}
/* Allocate a chunk of memory of SIZE bytes. Its contents are undefined. */
void *
ggc_alloc_stat (size_t size MEM_STAT_DECL)
ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
size_t order, word, bit, object_offset, object_size;
struct page_entry *entry;
@ -1605,20 +1606,6 @@ init_ggc (void)
G.save_in_use = XNEWVEC (unsigned long *, G.by_depth_max);
}
/* Start a new GGC zone. */
struct alloc_zone *
new_ggc_zone (const char *name ATTRIBUTE_UNUSED)
{
return NULL;
}
/* Destroy a GGC zone. */
void
destroy_ggc_zone (struct alloc_zone *zone ATTRIBUTE_UNUSED)
{
}
/* Merge the SAVE_IN_USE_P and IN_USE_P arrays in P so that IN_USE_P
reflects reality. Recalculate NUM_FREE_OBJECTS as well. */
@ -2383,3 +2370,12 @@ ggc_pch_read (FILE *f, void *addr)
/* Update the statistics. */
G.allocated = G.allocated_last_gc = offs - (char *)addr;
}
struct alloc_zone
{
int dummy;
};
struct alloc_zone rtl_zone;
struct alloc_zone tree_zone;
struct alloc_zone tree_id_zone;

View File

@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
#include "ggc-internal.h"
#include "timevar.h"
#include "params.h"
#include "bitmap.h"
@ -417,9 +418,9 @@ struct alloc_zone
#ifdef GATHER_STATISTICS
struct
{
/* Total memory allocated with ggc_alloc. */
/* Total GC-allocated memory. */
unsigned long long total_allocated;
/* Total overhead for memory to be allocated with ggc_alloc. */
/* Total overhead for GC-allocated memory. */
unsigned long long total_overhead;
/* Total allocations and overhead for sizes less than 32, 64 and 128.
@ -860,7 +861,7 @@ alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size, struct alloc_zone *zone)
zone->bytes_mapped += size;
/* Pretend we don't have access to the allocated pages. We'll enable
access to smaller pieces of the area in ggc_alloc. Discard the
access to smaller pieces of the area in ggc_internal_alloc. Discard the
handle to avoid handle leak. */
VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (page, size));
@ -1089,8 +1090,8 @@ free_chunk (char *ptr, size_t size, struct alloc_zone *zone)
/* Allocate a chunk of memory of at least ORIG_SIZE bytes, in ZONE. */
void *
ggc_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
MEM_STAT_DECL)
ggc_internal_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
MEM_STAT_DECL)
{
size_t bin;
size_t csize;
@ -1352,6 +1353,19 @@ ggc_alloc_zone_stat (size_t orig_size, struct alloc_zone *zone
return result;
}
#define ggc_internal_alloc_zone_pass_stat(s,z) \
ggc_internal_alloc_zone_stat (s,z PASS_MEM_STAT)
void *
ggc_internal_cleared_alloc_zone_stat (size_t orig_size,
struct alloc_zone *zone MEM_STAT_DECL)
{
void * result = ggc_internal_alloc_zone_pass_stat (orig_size, zone);
memset (result, 0, orig_size);
return result;
}
/* Allocate a SIZE of chunk memory of GTE type, into an appropriate zone
for that type. */
@ -1362,25 +1376,25 @@ ggc_alloc_typed_stat (enum gt_types_enum gte, size_t size
switch (gte)
{
case gt_ggc_e_14lang_tree_node:
return ggc_alloc_zone_pass_stat (size, &tree_zone);
return ggc_internal_alloc_zone_pass_stat (size, &tree_zone);
case gt_ggc_e_7rtx_def:
return ggc_alloc_zone_pass_stat (size, &rtl_zone);
return ggc_internal_alloc_zone_pass_stat (size, &rtl_zone);
case gt_ggc_e_9rtvec_def:
return ggc_alloc_zone_pass_stat (size, &rtl_zone);
return ggc_internal_alloc_zone_pass_stat (size, &rtl_zone);
default:
return ggc_alloc_zone_pass_stat (size, &main_zone);
return ggc_internal_alloc_zone_pass_stat (size, &main_zone);
}
}
/* Normal ggc_alloc simply allocates into the main zone. */
/* Normal GC allocation simply allocates into the main zone. */
void *
ggc_alloc_stat (size_t size MEM_STAT_DECL)
ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
{
return ggc_alloc_zone_pass_stat (size, &main_zone);
return ggc_internal_alloc_zone_pass_stat (size, &main_zone);
}
/* Poison the chunk. */
@ -1715,31 +1729,6 @@ new_ggc_zone_1 (struct alloc_zone *new_zone, const char * name)
G.zones->next_zone = new_zone;
}
struct alloc_zone *
new_ggc_zone (const char * name)
{
struct alloc_zone *new_zone = XCNEW (struct alloc_zone);
new_ggc_zone_1 (new_zone, name);
return new_zone;
}
/* Destroy a GGC zone. */
void
destroy_ggc_zone (struct alloc_zone * dead_zone)
{
struct alloc_zone *z;
for (z = G.zones; z && z->next_zone != dead_zone; z = z->next_zone)
/* Just find that zone. */
continue;
/* We should have found the zone in the list. Anything else is fatal. */
gcc_assert (z);
/* z is dead, baby. z is dead. */
z->dead = true;
}
/* Free all empty pages and objects within a page for a given zone */
static void
@ -2488,6 +2477,12 @@ ggc_pch_read (FILE *f, void *addr)
/* We've just read in a PCH file. So, every object that used to be
allocated is now free. */
#ifdef 0 && GATHER_STATISTICS
zone_allocate_marks ();
ggc_prune_overhead_list ();
zone_free_marks ();
#endif
for (zone = G.zones; zone; zone = zone->next_zone)
{
struct small_page_entry *page, *next_page;

292
gcc/ggc.h
View File

@ -1,7 +1,7 @@
/* Garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007,
2008, 2009 Free Software Foundation, Inc.
2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@ -28,11 +28,9 @@ along with GCC; see the file COPYING3. If not see
/* Constants for general use. */
extern const char empty_string[]; /* empty string */
extern const char digit_vector[]; /* "0" .. "9" */
#define digit_string(d) (digit_vector + ((d) * 2))
/* Internal functions and data structures used by the GTY
machinery. */
machinery, including the generated gt*.[hc] files. */
/* The first parameter is a pointer to a pointer, the second a cookie. */
typedef void (*gt_pointer_operator) (void *, void *);
@ -118,112 +116,48 @@ extern int ggc_set_mark (const void *);
static objects, stack variables, or memory allocated with malloc. */
extern int ggc_marked_p (const void *);
/* Mark the entries in the string pool. */
extern void ggc_mark_stringpool (void);
/* Purge the entries in the string pool. */
extern void ggc_purge_stringpool (void);
/* Call ggc_set_mark on all the roots. */
extern void ggc_mark_roots (void);
/* Save and restore the string pool entries for PCH. */
extern void gt_pch_save_stringpool (void);
extern void gt_pch_fixup_stringpool (void);
extern void gt_pch_restore_stringpool (void);
/* PCH and GGC handling for strings, mostly trivial. */
extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *);
extern void gt_pch_n_S (const void *);
extern void gt_ggc_m_S (const void *);
/* End of GTY machinery API. */
struct alloc_zone;
/* Initialize the string pool. */
extern void init_stringpool (void);
/* A GC implementation must provide these functions. They are internal
to the GC system. */
/* Forward declare the zone structure. Only ggc_zone implements this. */
struct alloc_zone;
/* Initialize the garbage collector. */
extern void init_ggc (void);
/* Start a new GGC zone. */
extern struct alloc_zone *new_ggc_zone (const char *);
/* Free a complete GGC zone, destroying everything in it. */
extern void destroy_ggc_zone (struct alloc_zone *);
struct ggc_pch_data;
/* Return a new ggc_pch_data structure. */
extern struct ggc_pch_data *init_ggc_pch (void);
/* The second parameter and third parameters give the address and size
of an object. Update the ggc_pch_data structure with as much of
that information as is necessary. The bool argument should be true
if the object is a string. */
extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool,
enum gt_types_enum);
/* Return the total size of the data to be written to hold all
the objects previously passed to ggc_pch_count_object. */
extern size_t ggc_pch_total_size (struct ggc_pch_data *);
/* The objects, when read, will most likely be at the address
in the second parameter. */
extern void ggc_pch_this_base (struct ggc_pch_data *, void *);
/* Assuming that the objects really do end up at the address
passed to ggc_pch_this_base, return the address of this object.
The bool argument should be true if the object is a string. */
extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool,
enum gt_types_enum);
/* Write out any initial information required. */
extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *);
/* Write out this object, including any padding. The last argument should be
true if the object is a string. */
extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *,
void *, size_t, bool);
/* All objects have been written, write out any final information
required. */
extern void ggc_pch_finish (struct ggc_pch_data *, FILE *);
/* A PCH file has just been read in at the address specified second
parameter. Set up the GC implementation for the new objects. */
extern void ggc_pch_read (FILE *, void *);
/* Allocation. */
/* When set, ggc_collect will do collection. */
extern bool ggc_force_collect;
/* When true, identifier nodes are considered as GC roots. When
false, identifier nodes are treated like any other GC-allocated
object, and the identifier hash table is treated as a weak
hash. */
extern bool ggc_protect_identifiers;
/* Write out all GCed objects to F. */
extern void gt_pch_save (FILE *f);
/* Allocation. */
/* The internal primitive. */
extern void *ggc_alloc_stat (size_t MEM_STAT_DECL);
#define ggc_alloc(s) ggc_alloc_stat (s MEM_STAT_INFO)
extern void *ggc_internal_alloc_stat (size_t MEM_STAT_DECL);
#define ggc_internal_alloc(s) ggc_internal_alloc_stat (s MEM_STAT_INFO)
/* Allocate an object of the specified type and size. */
extern void *ggc_alloc_typed_stat (enum gt_types_enum, size_t MEM_STAT_DECL);
#define ggc_alloc_typed(s,z) ggc_alloc_typed_stat (s,z MEM_STAT_INFO)
/* Like ggc_alloc, but allocates cleared memory. */
extern void *ggc_alloc_cleared_stat (size_t MEM_STAT_DECL);
#define ggc_alloc_cleared(s) ggc_alloc_cleared_stat (s MEM_STAT_INFO)
#define ggc_alloc_typed(s, z) ggc_alloc_typed_stat (s, z MEM_STAT_INFO)
/* Allocates cleared memory. */
extern void *ggc_internal_cleared_alloc_stat (size_t MEM_STAT_DECL);
/* Resize a block. */
extern void *ggc_realloc_stat (void *, size_t MEM_STAT_DECL);
#define ggc_realloc(s,z) ggc_realloc_stat (s,z MEM_STAT_INFO)
/* Like ggc_alloc_cleared, but performs a multiplication. */
extern void *ggc_calloc (size_t, size_t);
/* Free a block. To be used when known for certain it's not reachable. */
extern void ggc_free (void *);
@ -233,39 +167,67 @@ extern void ggc_prune_overhead_list (void);
extern void dump_ggc_loc_statistics (bool);
/* Type-safe, C++-friendly versions of ggc_alloc() and gcc_calloc(). */
#define GGC_NEW(T) ((T *) ggc_alloc (sizeof (T)))
#define GGC_CNEW(T) ((T *) ggc_alloc_cleared (sizeof (T)))
#define GGC_NEWVEC(T, N) ((T *) ggc_alloc ((N) * sizeof(T)))
#define GGC_CNEWVEC(T, N) ((T *) ggc_alloc_cleared ((N) * sizeof(T)))
#define GGC_RESIZEVEC(T, P, N) ((T *) ggc_realloc ((P), (N) * sizeof (T)))
#define GGC_NEWVAR(T, S) ((T *) ggc_alloc ((S)))
#define GGC_CNEWVAR(T, S) ((T *) ggc_alloc_cleared ((S)))
#define GGC_RESIZEVAR(T, P, N) ((T *) ggc_realloc ((P), (N)))
/* Reallocators. */
#define GGC_RESIZEVEC(T, P, N) \
((T *) ggc_realloc_stat ((P), (N) * sizeof (T) MEM_STAT_INFO))
#define ggc_alloc_rtvec(NELT) \
((rtvec) ggc_alloc_zone (sizeof (struct rtvec_def) + ((NELT) - 1) \
* sizeof (rtx), &rtl_zone))
#define GGC_RESIZEVAR(T, P, N) \
((T *) ggc_realloc_stat ((P), (N) MEM_STAT_INFO))
#define ggc_alloc_tree(LENGTH) ((tree) ggc_alloc_zone (LENGTH, &tree_zone))
static inline void *
ggc_internal_vec_alloc_stat (size_t s, size_t c MEM_STAT_DECL)
{
return ggc_internal_alloc_stat (c * s PASS_MEM_STAT);
}
static inline void *
ggc_internal_cleared_vec_alloc_stat (size_t s, size_t c MEM_STAT_DECL)
{
return ggc_internal_cleared_alloc_stat (c * s PASS_MEM_STAT);
}
#define ggc_internal_cleared_vec_alloc(s, c) \
(ggc_internal_cleared_vec_alloc_stat ((s), (c) MEM_STAT_INFO))
static inline void *
ggc_alloc_atomic_stat (size_t s MEM_STAT_DECL)
{
return ggc_internal_alloc_stat (s PASS_MEM_STAT);
}
#define ggc_alloc_atomic(S) (ggc_alloc_atomic_stat ((S) MEM_STAT_INFO))
#define ggc_alloc_cleared_atomic(S) \
(ggc_internal_cleared_alloc_stat ((S) MEM_STAT_INFO))
extern void * ggc_cleared_alloc_htab_ignore_args (size_t, size_t);
extern void * ggc_cleared_alloc_ptr_array_two_args (size_t, size_t);
#define htab_create_ggc(SIZE, HASH, EQ, DEL) \
htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, ggc_free)
htab_create_typed_alloc (SIZE, HASH, EQ, DEL, \
ggc_cleared_alloc_htab_ignore_args, \
ggc_cleared_alloc_ptr_array_two_args, \
ggc_free)
#define splay_tree_new_ggc(COMPARE, ALLOC_TREE, ALLOC_NODE) \
splay_tree_new_typed_alloc (COMPARE, NULL, NULL, &ALLOC_TREE, &ALLOC_NODE, \
&ggc_splay_dont_free, NULL)
extern void *ggc_splay_alloc (enum gt_types_enum, int, void *);
#define splay_tree_new_ggc(COMPARE) \
splay_tree_new_with_allocator (COMPARE, NULL, NULL, \
&ggc_splay_alloc, &ggc_splay_dont_free, \
NULL)
extern void *ggc_splay_alloc (int, void *);
extern void ggc_splay_dont_free (void *, void *);
/* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
If LENGTH is -1, then CONTENTS is assumed to be a
null-terminated string and the memory sized accordingly. */
extern const char *ggc_alloc_string (const char *contents, int length);
extern const char *ggc_alloc_string_stat (const char *contents, int length
MEM_STAT_DECL);
#define ggc_alloc_string(c, l) ggc_alloc_string_stat (c, l MEM_STAT_INFO)
/* Make a copy of S, in GC-able memory. */
#define ggc_strdup(S) ggc_alloc_string((S), -1)
#define ggc_strdup(S) ggc_alloc_string_stat ((S), -1 MEM_STAT_INFO)
/* Invoke the collector. Garbage collection occurs only when this
function is called, not during allocations. */
@ -279,55 +241,117 @@ extern void ggc_register_root_tab (const struct ggc_root_tab *);
plugins. Does nothing if the passed pointer is NULL. */
extern void ggc_register_cache_tab (const struct ggc_cache_tab *);
/* Return the number of bytes allocated at the indicated address. */
extern size_t ggc_get_size (const void *);
/* Write out all GCed objects to F. */
extern void gt_pch_save (FILE *f);
/* Read objects previously saved with gt_pch_save from F. */
extern void gt_pch_restore (FILE *f);
/* Statistics. */
/* This structure contains the statistics common to all collectors.
Particular collectors can extend this structure. */
typedef struct ggc_statistics
{
/* At present, we don't really gather any interesting statistics. */
int unused;
} ggc_statistics;
/* Used by the various collectors to gather and print statistics that
do not depend on the collector in use. */
extern void ggc_print_common_statistics (FILE *, ggc_statistics *);
/* Print allocation statistics. */
extern void ggc_print_statistics (void);
extern void stringpool_statistics (void);
/* Heuristics. */
extern void init_ggc_heuristics (void);
/* Zone collection. */
#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
/* For regular rtl allocations. */
extern struct alloc_zone rtl_zone;
/* For regular tree allocations. */
extern struct alloc_zone tree_zone;
/* For IDENTIFIER_NODE allocations. */
extern struct alloc_zone tree_id_zone;
#define ggc_alloc_rtvec_sized(NELT) \
(ggc_alloc_zone_vec_rtvec_def (sizeof (rtx), \
sizeof (struct rtvec_def) + ((NELT) - 1), \
&rtl_zone))
#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
/* Allocate an object into the specified allocation zone. */
extern void *ggc_alloc_zone_stat (size_t, struct alloc_zone * MEM_STAT_DECL);
# define ggc_alloc_zone(s,z) ggc_alloc_zone_stat (s,z MEM_STAT_INFO)
# define ggc_alloc_zone_pass_stat(s,z) ggc_alloc_zone_stat (s,z PASS_MEM_STAT)
extern void *ggc_internal_alloc_zone_stat (size_t,
struct alloc_zone * MEM_STAT_DECL);
extern void *ggc_internal_cleared_alloc_zone_stat (size_t,
struct alloc_zone * MEM_STAT_DECL);
static inline void *
ggc_internal_zone_alloc_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
{
return ggc_internal_alloc_zone_stat (s, z PASS_MEM_STAT);
}
static inline void *
ggc_internal_zone_cleared_alloc_stat (struct alloc_zone * z, size_t s
MEM_STAT_DECL)
{
return ggc_internal_cleared_alloc_zone_stat (s, z PASS_MEM_STAT);
}
static inline void *
ggc_internal_zone_vec_alloc_stat (struct alloc_zone * z, size_t s, size_t n
MEM_STAT_DECL)
{
return ggc_internal_alloc_zone_stat (s * n, z PASS_MEM_STAT);
}
#else
# define ggc_alloc_zone(s, z) ggc_alloc (s)
# define ggc_alloc_zone_pass_stat(s, z) ggc_alloc_stat (s PASS_MEM_STAT)
static inline void *
ggc_internal_zone_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
size_t s MEM_STAT_DECL)
{
return ggc_internal_alloc_stat (s PASS_MEM_STAT);
}
static inline void *
ggc_internal_zone_cleared_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
size_t s MEM_STAT_DECL)
{
return ggc_internal_cleared_alloc_stat (s PASS_MEM_STAT);
}
static inline void *
ggc_internal_zone_vec_alloc_stat (struct alloc_zone * z ATTRIBUTE_UNUSED,
size_t s, size_t n MEM_STAT_DECL)
{
return ggc_internal_vec_alloc_stat (s, n PASS_MEM_STAT);
}
#endif
/* Memory statistics passing versions of some allocators. Too few of them to
make gengtype produce them, so just define the needed ones here. */
static inline struct rtx_def *
ggc_alloc_zone_rtx_def_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
{
return (struct rtx_def *) ggc_internal_zone_alloc_stat (z, s PASS_MEM_STAT);
}
static inline union tree_node *
ggc_alloc_zone_tree_node_stat (struct alloc_zone * z, size_t s MEM_STAT_DECL)
{
return (union tree_node *) ggc_internal_zone_alloc_stat (z, s PASS_MEM_STAT);
}
static inline union tree_node *
ggc_alloc_zone_cleared_tree_node_stat (struct alloc_zone * z, size_t s
MEM_STAT_DECL)
{
return (union tree_node *)
ggc_internal_zone_cleared_alloc_stat (z, s PASS_MEM_STAT);
}
static inline union gimple_statement_d *
ggc_alloc_cleared_gimple_statement_d_stat (size_t s MEM_STAT_DECL)
{
return (union gimple_statement_d *)
ggc_internal_cleared_alloc_stat (s PASS_MEM_STAT);
}
#endif

View File

@ -404,7 +404,7 @@ gsi_insert_before_without_update (gimple_stmt_iterator *i, gimple stmt,
{
gimple_seq_node n;
n = GGC_NEW (struct gimple_seq_node_d);
n = ggc_alloc_gimple_seq_node_d ();
n->prev = n->next = NULL;
n->stmt = stmt;
gsi_insert_seq_nodes_before (i, n, n, m);
@ -439,7 +439,7 @@ gsi_insert_after_without_update (gimple_stmt_iterator *i, gimple stmt,
{
gimple_seq_node n;
n = GGC_NEW (struct gimple_seq_node_d);
n = ggc_alloc_gimple_seq_node_d ();
n->prev = n->next = NULL;
n->stmt = stmt;
gsi_insert_seq_nodes_after (i, n, n, m);

View File

@ -145,7 +145,7 @@ gimple_alloc_stat (enum gimple_code code, unsigned num_ops MEM_STAT_DECL)
}
#endif
stmt = (gimple) ggc_alloc_cleared_stat (size PASS_MEM_STAT);
stmt = ggc_alloc_cleared_gimple_statement_d_stat (size PASS_MEM_STAT);
gimple_set_code (stmt, code);
gimple_set_num_ops (stmt, num_ops);
@ -824,7 +824,8 @@ gimple_build_omp_for (gimple_seq body, tree clauses, size_t collapse,
gimple_omp_set_body (p, body);
gimple_omp_for_set_clauses (p, clauses);
p->gimple_omp_for.collapse = collapse;
p->gimple_omp_for.iter = GGC_CNEWVEC (struct gimple_omp_for_iter, collapse);
p->gimple_omp_for.iter
= ggc_alloc_cleared_vec_gimple_omp_for_iter (collapse);
if (pre_body)
gimple_omp_for_set_pre_body (p, pre_body);
@ -1074,7 +1075,7 @@ gimple_seq_alloc (void)
}
else
{
seq = (gimple_seq) ggc_alloc_cleared (sizeof (*seq));
seq = ggc_alloc_cleared_gimple_seq_d ();
#ifdef GATHER_STATISTICS
gimple_alloc_counts[(int) gimple_alloc_kind_seq]++;
gimple_alloc_sizes[(int) gimple_alloc_kind_seq] += sizeof (*seq);
@ -2122,8 +2123,8 @@ gimple_copy (gimple stmt)
t = unshare_expr (gimple_omp_for_clauses (stmt));
gimple_omp_for_set_clauses (copy, t);
copy->gimple_omp_for.iter
= GGC_NEWVEC (struct gimple_omp_for_iter,
gimple_omp_for_collapse (stmt));
= ggc_alloc_vec_gimple_omp_for_iter
(gimple_omp_for_collapse (stmt));
for (i = 0; i < gimple_omp_for_collapse (stmt); i++)
{
gimple_omp_for_set_cond (copy, i,

View File

@ -752,7 +752,7 @@ enum gimple_statement_structure_enum {
/* Define the overall contents of a gimple tuple. It may be any of the
structures declared above for various types of tuples. */
union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;

View File

@ -246,10 +246,10 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
ivs = crtl->hard_reg_initial_vals;
if (ivs == 0)
{
ivs = GGC_NEW (initial_value_struct);
ivs = ggc_alloc_initial_value_struct ();
ivs->num_entries = 0;
ivs->max_entries = 5;
ivs->entries = GGC_NEWVEC (initial_value_pair, 5);
ivs->entries = ggc_alloc_vec_initial_value_pair (5);
crtl->hard_reg_initial_vals = ivs;
}

View File

@ -838,7 +838,7 @@ ipcp_create_replace_map (tree parm_tree, struct ipcp_lattice *lat)
struct ipa_replace_map *replace_map;
tree const_val;
replace_map = GGC_NEW (struct ipa_replace_map);
replace_map = ggc_alloc_ipa_replace_map ();
const_val = build_const_val (lat, TREE_TYPE (parm_tree));
if (dump_file)
{

View File

@ -892,8 +892,8 @@ ipa_compute_jump_functions_for_edge (struct cgraph_edge *cs)
if (ipa_get_cs_argument_count (arguments) == 0 || arguments->jump_functions)
return;
arguments->jump_functions = GGC_CNEWVEC (struct ipa_jump_func,
ipa_get_cs_argument_count (arguments));
arguments->jump_functions = ggc_alloc_cleared_vec_ipa_jump_func
(ipa_get_cs_argument_count (arguments));
call = cs->call_stmt;
gcc_assert (is_gimple_call (call));
@ -1696,18 +1696,16 @@ duplicate_array (void *src, size_t n)
return p;
}
/* Like duplicate_array byt in GGC memory. */
static void *
duplicate_ggc_array (void *src, size_t n)
static struct ipa_jump_func *
duplicate_ipa_jump_func_array (const struct ipa_jump_func * src, size_t n)
{
void *p;
struct ipa_jump_func *p;
if (!src)
return NULL;
p = ggc_alloc (n);
memcpy (p, src, n);
p = ggc_alloc_vec_ipa_jump_func (n);
memcpy (p, src, n * sizeof (struct ipa_jump_func));
return p;
}
@ -1727,9 +1725,8 @@ ipa_edge_duplication_hook (struct cgraph_edge *src, struct cgraph_edge *dst,
arg_count = ipa_get_cs_argument_count (old_args);
ipa_set_cs_argument_count (new_args, arg_count);
new_args->jump_functions = (struct ipa_jump_func *)
duplicate_ggc_array (old_args->jump_functions,
sizeof (struct ipa_jump_func) * arg_count);
new_args->jump_functions =
duplicate_ipa_jump_func_array (old_args->jump_functions, arg_count);
if (iinlining_processed_edges
&& bitmap_bit_p (iinlining_processed_edges, src->uid))
@ -2525,8 +2522,8 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
if (!count)
continue;
args->jump_functions = GGC_CNEWVEC (struct ipa_jump_func,
ipa_get_cs_argument_count (args));
args->jump_functions = ggc_alloc_cleared_vec_ipa_jump_func
(ipa_get_cs_argument_count (args));
for (k = 0; k < ipa_get_cs_argument_count (args); k++)
ipa_read_jump_function (ib, ipa_get_ith_jump_func (args, k), data_in);
}

View File

@ -887,7 +887,7 @@ cgraph_node_set_new (void)
{
cgraph_node_set new_node_set;
new_node_set = GGC_NEW (struct cgraph_node_set_def);
new_node_set = ggc_alloc_cgraph_node_set_def ();
new_node_set->hashtab = htab_create_ggc (10,
hash_cgraph_node_set_element,
eq_cgraph_node_set_element,
@ -918,8 +918,7 @@ cgraph_node_set_add (cgraph_node_set set, struct cgraph_node *node)
}
/* Insert node into hash table. */
element =
(cgraph_node_set_element) GGC_NEW (struct cgraph_node_set_element_def);
element = ggc_alloc_cgraph_node_set_element_def ();
element->node = node;
element->index = VEC_length (cgraph_node_ptr, set->nodes);
*slot = element;
@ -1045,7 +1044,7 @@ varpool_node_set_new (void)
{
varpool_node_set new_node_set;
new_node_set = GGC_NEW (struct varpool_node_set_def);
new_node_set = ggc_alloc_varpool_node_set_def ();
new_node_set->hashtab = htab_create_ggc (10,
hash_varpool_node_set_element,
eq_varpool_node_set_element,
@ -1076,8 +1075,7 @@ varpool_node_set_add (varpool_node_set set, struct varpool_node *node)
}
/* Insert node into hash table. */
element =
(varpool_node_set_element) GGC_NEW (struct varpool_node_set_element_def);
element = ggc_alloc_varpool_node_set_element_def ();
element->node = node;
element->index = VEC_length (varpool_node_ptr, set->nodes);
*slot = element;

View File

@ -1791,8 +1791,7 @@ fix_reg_equiv_init (void)
if (reg_equiv_init_size < max_regno)
{
reg_equiv_init
= (rtx *) ggc_realloc (reg_equiv_init, max_regno * sizeof (rtx));
reg_equiv_init = GGC_RESIZEVEC (rtx, reg_equiv_init, max_regno);
while (reg_equiv_init_size < max_regno)
reg_equiv_init[reg_equiv_init_size++] = NULL_RTX;
for (i = FIRST_PSEUDO_REGISTER; i < reg_equiv_init_size; i++)
@ -2371,7 +2370,7 @@ update_equiv_regs (void)
recorded_label_ref = 0;
reg_equiv = XCNEWVEC (struct equivalence, max_regno);
reg_equiv_init = GGC_CNEWVEC (rtx, max_regno);
reg_equiv_init = ggc_alloc_cleared_vec_rtx (max_regno);
reg_equiv_init_size = max_regno;
init_alias_analysis ();

View File

@ -1,3 +1,38 @@
2010-06-08 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation.
* jcf-parse.c (java_parse_file): Likewise.
(process_zip_dir): Likewise.
* java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise.
(MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise.
* expr.c (add_type_assertion): Likewise.
* decl.c (make_binding_level): Likewise.
(java_dup_lang_specific_decl): Likewise.
* constants.c (set_constant_entry): Likewise.
(cpool_for_class): Likewise.
* class.c (add_method_1): Likewise.
(java_treetreehash_new): Likewise.
* java-tree.h (struct lang_type): Add variable_size GTY option.
(struct lang_decl): Likewise.
* jch.h (struct cpool_entry): Likewise.
* java-tree.h (java_treetreehash_create): Remove parameter ggc.
* except.c (prepare_eh_table_type): Update
java_treetreehash_create call.
* class.c (add_method_1): Update java_treetreehash_create call.
(java_treetreehash_create): Remove parameter gc. Use
htab_create_ggc.
2010-06-04 Joseph Myers <joseph@codesourcery.com>
* jvspec.c (lang_specific_driver): Use GCC-specific formats in

View File

@ -763,13 +763,12 @@ add_method_1 (tree this_class, int access_flags, tree name, tree function_type)
DECL_CONTEXT (fndecl) = this_class;
DECL_LANG_SPECIFIC (fndecl)
= GGC_CNEW (struct lang_decl);
= ggc_alloc_cleared_lang_decl(sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (fndecl)->desc = LANG_DECL_FUNC;
/* Initialize the static initializer test table. */
DECL_FUNCTION_INIT_TEST_TABLE (fndecl) =
java_treetreehash_create (10, 1);
DECL_FUNCTION_INIT_TEST_TABLE (fndecl) = java_treetreehash_create (10);
/* Initialize the initialized (static) class table. */
if (access_flags & ACC_STATIC)
@ -3144,7 +3143,7 @@ java_treetreehash_new (htab_t ht, tree t)
e = htab_find_slot_with_hash (ht, t, hv, INSERT);
if (*e == NULL)
{
tthe = (struct treetreehash_entry *) (*ht->alloc_f) (1, sizeof (*tthe));
tthe = ggc_alloc_cleared_treetreehash_entry ();
tthe->key = t;
*e = tthe;
}
@ -3154,14 +3153,10 @@ java_treetreehash_new (htab_t ht, tree t)
}
htab_t
java_treetreehash_create (size_t size, int gc)
java_treetreehash_create (size_t size)
{
if (gc)
return htab_create_ggc (size, java_treetreehash_hash,
java_treetreehash_compare, NULL);
else
return htab_create_alloc (size, java_treetreehash_hash,
java_treetreehash_compare, free, xcalloc, free);
return htab_create_ggc (size, java_treetreehash_hash,
java_treetreehash_compare, NULL);
}
/* Break down qualified IDENTIFIER into package and class-name components.

View File

@ -44,8 +44,11 @@ set_constant_entry (CPool *cpool, int index, int tag, jword value)
if (cpool->data == NULL)
{
cpool->capacity = 100;
cpool->tags = GGC_CNEWVEC (uint8, cpool->capacity);
cpool->data = GGC_CNEWVEC (union cpool_entry, cpool->capacity);
cpool->tags = (uint8 *) ggc_alloc_cleared_atomic (sizeof (uint8)
* cpool->capacity);
cpool->data = ggc_alloc_cleared_vec_cpool_entry (sizeof
(union cpool_entry),
cpool->capacity);
cpool->count = 1;
}
if (index >= cpool->capacity)
@ -333,7 +336,7 @@ cpool_for_class (tree klass)
if (cpool == NULL)
{
cpool = GGC_CNEW (struct CPool);
cpool = ggc_alloc_cleared_CPool ();
TYPE_CPOOL (klass) = cpool;
}
return cpool;

View File

@ -1354,7 +1354,7 @@ static struct binding_level *
make_binding_level (void)
{
/* NOSTRICT */
return GGC_CNEW (struct binding_level);
return ggc_alloc_cleared_binding_level ();
}
void
@ -1696,7 +1696,7 @@ java_dup_lang_specific_decl (tree node)
return;
lang_decl_size = sizeof (struct lang_decl);
x = GGC_NEW (struct lang_decl);
x = ggc_alloc_lang_decl (lang_decl_size);
memcpy (x, DECL_LANG_SPECIFIC (node), lang_decl_size);
DECL_LANG_SPECIFIC (node) = x;
}

View File

@ -381,7 +381,7 @@ prepare_eh_table_type (tree type)
return NULL_TREE;
if (TYPE_TO_RUNTIME_MAP (output_class) == NULL)
TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10, 1);
TYPE_TO_RUNTIME_MAP (output_class) = java_treetreehash_create (10);
slot = java_treetreehash_new (TYPE_TO_RUNTIME_MAP (output_class), type);
if (*slot != NULL)

View File

@ -463,7 +463,7 @@ add_type_assertion (tree klass, int assertion_code, tree op1, tree op2)
if (*as_pp)
return;
*as_pp = ggc_alloc (sizeof (type_assertion));
*as_pp = ggc_alloc_type_assertion ();
**(type_assertion **)as_pp = as;
}

View File

@ -750,11 +750,12 @@ union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
(DECL_LANG_SPECIFIC (NODE)->u.v.vtable)
/* Create a DECL_LANG_SPECIFIC if necessary. */
#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
if (DECL_LANG_SPECIFIC (T) == NULL) \
{ \
DECL_LANG_SPECIFIC ((T)) = GGC_CNEW (struct lang_decl); \
DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
if (DECL_LANG_SPECIFIC (T) == NULL) \
{ \
DECL_LANG_SPECIFIC ((T)) \
= ggc_alloc_cleared_lang_decl (sizeof (struct lang_decl)); \
DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
}
/* A ConstantExpression, after folding and name resolution. */
@ -840,7 +841,7 @@ typedef struct GTY(()) type_assertion {
extern tree java_treetreehash_find (htab_t, tree);
extern tree * java_treetreehash_new (htab_t, tree);
extern htab_t java_treetreehash_create (size_t size, int ggc);
extern htab_t java_treetreehash_create (size_t size);
/* DECL_LANG_SPECIFIC for VAR_DECL, PARM_DECL and sometimes FIELD_DECL
(access methods on outer class fields) and final fields. */
@ -861,7 +862,7 @@ struct GTY(()) lang_decl_var {
enum lang_decl_desc {LANG_DECL_FUNC, LANG_DECL_VAR};
struct GTY(()) lang_decl {
struct GTY((variable_size)) lang_decl {
enum lang_decl_desc desc;
union lang_decl_u
{
@ -879,7 +880,7 @@ struct GTY(()) lang_decl {
#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
TYPE_LANG_SPECIFIC ((T)) \
= GGC_CNEW (struct lang_type);
= ggc_alloc_cleared_lang_type (sizeof (struct lang_type));
#define TYPE_DUMMY(T) (TYPE_LANG_SPECIFIC(T)->dummy_class)
@ -924,7 +925,10 @@ typedef struct GTY(()) method_entry_d {
DEF_VEC_O(method_entry);
DEF_VEC_ALLOC_O(method_entry,gc);
struct GTY(()) lang_type {
/* FIXME: the variable_size annotation here is needed because these types are
variable-sized in some other frontends. Due to gengtype deficiency the GTY
options of such types have to agree across all frontends. */
struct GTY((variable_size)) lang_type {
tree signature;
struct JCF *jcf;
struct CPool *cpool;

View File

@ -1906,8 +1906,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
if (magic == 0xcafebabe)
{
CLASS_FILE_P (node) = 1;
current_jcf = GGC_NEW (JCF);
JCF_ZERO (current_jcf);
current_jcf = ggc_alloc_cleared_JCF ();
current_jcf->read_state = finput;
current_jcf->filbuf = jcf_filbuf_from_stdio;
jcf_parse (current_jcf);
@ -1924,8 +1923,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
else if (magic == (JCF_u4)ZIPMAGIC)
{
main_jcf = GGC_NEW (JCF);
JCF_ZERO (main_jcf);
main_jcf = ggc_alloc_cleared_JCF ();
main_jcf->read_state = finput;
main_jcf->filbuf = jcf_filbuf_from_stdio;
linemap_add (line_table, LC_ENTER, false, filename, 0);
@ -2181,8 +2179,7 @@ process_zip_dir (FILE *finput)
class_name = compute_class_name (zdir);
file_name = XNEWVEC (char, zdir->filename_length+1);
jcf = GGC_NEW (JCF);
JCF_ZERO (jcf);
jcf = ggc_alloc_cleared_JCF ();
strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
file_name [zdir->filename_length] = '\0';

View File

@ -331,8 +331,8 @@ jcf_parse_constant_pool (JCF* jcf)
{
int i, n;
JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf));
jcf->cpool.tags = GGC_NEWVAR (uint8, JPOOL_SIZE (jcf));
jcf->cpool.data = GGC_NEWVAR (union cpool_entry, sizeof (jword) * JPOOL_SIZE (jcf));
jcf->cpool.tags = (uint8 *) ggc_alloc_atomic (JPOOL_SIZE (jcf));
jcf->cpool.data = ggc_alloc_cpool_entry (sizeof (jword) * JPOOL_SIZE (jcf));
jcf->cpool.tags[0] = 0;
#ifdef HANDLE_START_CONSTANT_POOL
HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf));

View File

@ -66,7 +66,7 @@ jcf_open_exact_case (const char* filename, int oflag);
struct JCF;
typedef int (*jcf_filbuf_t) (struct JCF*, int needed);
union GTY(()) cpool_entry {
union GTY((variable_size)) cpool_entry {
jword GTY ((tag ("0"))) w;
tree GTY ((tag ("1"))) t;
};

View File

@ -1703,7 +1703,7 @@ remove_iv (gimple iv_stmt)
TRANSFORM is the matrix transform that was applied to OLD_LOOPNEST to get
NEW_LOOPNEST. */
void
void
lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
VEC(tree,heap) *old_ivs,
VEC(tree,heap) *invariants,
@ -2131,7 +2131,7 @@ replace_uses_equiv_to_x_with_y (struct loop *loop, gimple stmt, tree x,
gsi_insert_before (firstbsi, setstmt, GSI_SAME_STMT);
update_stmt (setstmt);
SET_USE (use_p, var);
h = GGC_NEW (struct tree_map);
h = ggc_alloc_tree_map ();
h->hash = in.hash;
h->base.from = use;
h->to = var;

View File

@ -238,7 +238,7 @@ static inline void print_lambda_vector (FILE *, lambda_vector, int);
static inline lambda_vector
lambda_vector_new (int size)
{
return GGC_CNEWVEC (int, size);
return (lambda_vector) ggc_alloc_cleared_atomic (sizeof (int) * size);
}

View File

@ -45,7 +45,7 @@ loop_optimizer_init (unsigned flags)
struct loops *loops;
gcc_assert (!current_loops);
loops = GGC_CNEW (struct loops);
loops = ggc_alloc_cleared_loops ();
/* Find the loops. */

View File

@ -1570,7 +1570,7 @@ input_node_opt_summary (struct cgraph_node *node,
{
int parm_num;
tree parm;
struct ipa_replace_map *map = GGC_NEW (struct ipa_replace_map);
struct ipa_replace_map *map = ggc_alloc_ipa_replace_map ();
VEC_safe_push (ipa_replace_map_p, gc, node->clone.tree_map, map);
for (parm_num = 0, parm = DECL_ARGUMENTS (node->decl); parm_num;

View File

@ -433,11 +433,7 @@ lto_get_decl_name_mapping (struct lto_file_decl_data *decl_data,
struct lto_in_decl_state *
lto_new_in_decl_state (void)
{
struct lto_in_decl_state *state;
state = ((struct lto_in_decl_state *) ggc_alloc (sizeof (*state)));
memset (state, 0, sizeof (*state));
return state;
return ggc_alloc_cleared_lto_in_decl_state ();
}
/* Delete STATE and its components. */

View File

@ -389,7 +389,7 @@ lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
lto_tag_check_range (tag, LTO_eh_catch, LTO_eh_catch);
/* Read the catch node. */
n = GGC_CNEW (struct eh_catch_d);
n = ggc_alloc_cleared_eh_catch_d ();
n->type_list = lto_input_tree (ib, data_in);
n->filter_list = lto_input_tree (ib, data_in);
n->label = lto_input_tree (ib, data_in);
@ -429,7 +429,7 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
if (tag == LTO_null)
return NULL;
r = GGC_CNEW (struct eh_region_d);
r = ggc_alloc_cleared_eh_region_d ();
r->index = lto_input_sleb128 (ib);
gcc_assert (r->index == ix);
@ -502,7 +502,7 @@ input_eh_lp (struct lto_input_block *ib, struct data_in *data_in, int ix)
lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad);
lp = GGC_CNEW (struct eh_landing_pad_d);
lp = ggc_alloc_cleared_eh_landing_pad_d ();
lp->index = lto_input_sleb128 (ib);
gcc_assert (lp->index == ix);
lp->next_lp = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib);
@ -707,7 +707,7 @@ make_new_block (struct function *fn, unsigned int index)
basic_block bb = alloc_block ();
bb->index = index;
SET_BASIC_BLOCK_FOR_FUNCTION (fn, index, bb);
bb->il.gimple = GGC_CNEW (struct gimple_bb_info);
bb->il.gimple = ggc_alloc_cleared_gimple_bb_info ();
n_basic_blocks_for_function (fn)++;
bb->flags = 0;
set_bb_seq (bb, gimple_seq_alloc ());
@ -1621,7 +1621,7 @@ unpack_ts_real_cst_value_fields (struct bitpack_d *bp, tree expr)
for (i = 0; i < SIGSZ; i++)
r.sig[i] = (unsigned long) bp_unpack_value (bp, HOST_BITS_PER_LONG);
rp = GGC_NEW (REAL_VALUE_TYPE);
rp = ggc_alloc_real_value ();
memcpy (rp, &r, sizeof (REAL_VALUE_TYPE));
TREE_REAL_CST_PTR (expr) = rp;
}

View File

@ -605,6 +605,8 @@ struct GTY(()) lto_file_decl_data
htab_t GTY((skip)) renaming_hash_table;
};
typedef struct lto_file_decl_data *lto_file_decl_data_ptr;
struct lto_char_ptr_base
{
char *ptr;

View File

@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tree.h"
#include "gimple.h"
#include "ggc.h" /* lambda.h needs this */
#include "ggc.h"
#include "lambda.h" /* gcd */
#include "hashtab.h"
#include "plugin-api.h"
@ -152,7 +152,7 @@ lto_symtab_register_decl (tree decl,
if (TREE_CODE (decl) == FUNCTION_DECL)
gcc_assert (!DECL_ABSTRACT (decl));
new_entry = GGC_CNEW (struct lto_symtab_entry_def);
new_entry = ggc_alloc_cleared_lto_symtab_entry_def ();
new_entry->id = DECL_ASSEMBLER_NAME (decl);
new_entry->decl = decl;
new_entry->resolution = resolution;

Some files were not shown because too many files have changed in this diff Show More