1999-09-11 21:48:37 +02:00
|
|
|
|
/* Simple garbage collection for the GNU compiler.
|
2006-07-07 16:23:57 +02:00
|
|
|
|
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
2003-03-04 18:51:00 +01:00
|
|
|
|
Free Software Foundation, Inc.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
This file is part of GCC.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
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 2, or (at your option) any later
|
|
|
|
|
version.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
[multiple changes]
Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR>
* gcov.c (DIR_SEPARATOR): Provide default.
(output_data): Add test for MS-DOS format absolute filename.
(fancy_abort): Correct program name.
(open_files): Open all files in binary mode.
* libgcc2.c (__bb_exit_func): Likewise.
* profile.c (init_branch_prob): Specify binary when opening files.
* flags.h (flag_unwind_tables): New decl.
* toplev.c (flag_unwind_table): New definition.
(f_options): Add -funwind-tables.
(decode_g_option): Clarify warning when unknown -g option is given.
(rest_of_compilation): If inside an inlined external function,
pretend we are just being declared.
* dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables.
(dwarf2out_frame_finish): Likewise.
Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com>
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.
Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt>
* fold-const.c (merge_ranges): In not in0, but in1, handle
upper bounds equal like subset case.
Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com>
* dbxout.c (dbxout_parms): Generate a second stabs line for parameters
passed in a register but moved to the stack.
Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr>
* gcc.c (pass_exit_codes, greatest_status): New variables.
(struct option_map): Add entry for "--pass-exit-codes".
(execute): Update greatest_status if error.
(display_help): Add documentation for -pass-exit-codes.
(process_command): Handle -pass-exit-codes.
(main): Look at pass_exit_codes and greatest_status on call to exit.
Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* reload.c (find_reloads): Refine test for no input reload
case to not includes reloads emitted after insn.
* function.c (find_temp_slots_from_address): Handle sum involving
a register that points to a temp slot.
(update_temp_slot_address): Make recursive call if both old and
new are PLUS with a common operand.
* calls.c (expand_call): Mark temp slot for result as having
address taken.
* rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case.
* gcc.c (process_command): Add standard_exec_prefix with "GCC"
component as well as "BINUTILS".
* integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS.
* integrate.c (copy_rtx_and_substitute): Likewise.
(expand_inline_function, integrate_parm_decls, integrate_decl_tree):
All callers changed.
* unroll.c (inital_reg_note_copy, copy_loop_body): Likewise.
* dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use
gdb extensions, write size of type; also be more consistent
in using references when this is a subtype.
* pa.md (extv, extzv, insv): Use define_expand to reject constant
that is out of range.
* loop.c (unknown_constant_address_altered): New variable.
(prescan_loop): Initialize it.
(note_addr_stored): Set it for RTX_UNCHANGING_P MEM.
(invariant_p, case MEM): Remove handling for volatile and readony;
check new variable if readonly.
(check_dbra_loop): Chdeck unknown_constant_address_altered.
* cse.c (canon_hash, case MEM): Do not record if BLKmode.
(addr_affects_sp_p): Removed from note_mem_written and only
define #ifdef AUTO_INC_DEC.
* alpha.c (input_operand, case ADDRESSOF): Treat as REG.
* regclass.c (record_reg_classes): Properly handle register move
directions.
* varasm.c (initializer_constant_valid_p, case MINUS_EXPR):
Don't think valid if both operands are invalid.
(struct constant_descriptor): New field RTL.
(mark_const_hash_entry): Mark it.
(record_constant{,_rtx}): Initialize it.
(output_constant_def): Allocate RTL in permanent obstack and
save in table.
({record,compare}_constant_1): Modes must match for
CONSTRUCTOR of ARRAY_TYPE.
* c-common.h (initializer_constant_valid_p): Delete decl from here.
* output.h (initializer_constant_valid_p): Move decl to here.
* c-common.c (initializer_constant_valid_p): Delete function from here.
* varasm.c (initializer_constant_valid_p): Move function to here.
* tree.h (STRIP_SIGN_NOPS): New macro.
* fold-const.c (optimize_minmax_comparison): New function.
(invert_truthvalue, case WITH_RECORD_EXPR): New case.
(fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS.
(fold, case EQ_EXPR): Call optimize_minmax_comparison and add
cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and
widening conversions.
(fold, case LE_EXPR): Rework changing unsigned to signed comparisons
to look at size of mode, not precision of type; also add missing cases.
(optimize_bit_field_compare, decode_field_reference): Don't try to
optimize COMPONENT_REF of a PLACEHOLDER_EXPR.
* dwarf2out.c (ctype.h): Include.
(dwarf2out_set_demangle_name_func): New function.
(size_of_line_info): Deleted.
(output_line_info): Compute size of line info table from difference
of labels.
(base_type_die, add_name_attribute): Call demangle function, if any.
(field_byte_offset): Use bits per word for variable length fields.
(gen_array_type_die): Add array name.
(gen_subprogram_die): Ignore DECL_INLINE if -fno-inline.
(dwarf2out_add_library_unit_info): New function.
* explow.c (set_stack_check_libfunc): New function.
(stack_check_libfunc): New static variable.
(probe_stack_range): Allow front-end to set up a libfunc to call.
* combine.c (simplify_comparison): When making comparison in wider
mode, check for having commuted an AND and a SUBREG.
(contains_muldiv): New function.
(try_combine): Call it when dividing a PARALLEL.
(simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart.
(simplify_comparison, case ASHIFTRT): Recognize sign-extension of
a PLUS.
(record_value_for_reg): If TEM is a binary operation with two CLOBBERs,
use one of the CLOBBERs instead.
(if_then_else_cond): If comparing against zero, just return thing
being compared.
* optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x).
Don't generate shifts and subtract if have conditional arithmetic.
* rtl.h (delete_barrier): New declaration.
* jump.c (jump_optimize): Set up to handle conditional call.
In conditional arithmetic case, handle CALL_INSN followed by a BARRIER.
(delete_barrier): New function.
* rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode.
* recog.c (nonmemory_operand): Accept ADDRESSOF.
* tree.c (build_type_attribute_variant): Push to obstack of
ttype around type_hash_canon call.
* expr.c (placeholder_list): Move decl to file scope.
(expand_expr): Don't force access to volatile just because its
address is taken.
If ignoring reference operations, just expand the operands.
(expand_expr, case COMPONENT_REF): Propagate
EXPAND_CONST_ADDRESS to recursive call when expanding inner.
Refine test for using bitfield operations vs pointer punning.
(expand_expr, case CONVERT_EXPR): If converting to
BLKmode UNION_TYPE from BLKmode, just return inner object.
Use proper mode in store_field call.
Properly set sizes of object to store and total size in store_field
call for convert to union.
(expand_expr, case ARRAY_REF): If OP0 is in a register, put it in
memory (like for ADDR_EXPR). Also, don't put constant in register if
we'll want it in memory.
(readonly_fields_p): New function.
(expand_expr, case INDIRECT_REF): Call it if LHS.
(expand_assignment): Handle a RESULT_DECL where
DECL_RTL is a PARALLEL.
(do_jump, case WITH_RECORD_EXPR): New case.
(get_inner_reference): Always go inside a CONVERT_EXPR
and NOP_EXPR if both modes are the same.
(store_field): Use bitfield operations if size of bitsize is not same
as size of RHS's type.
Check for bitpos not a multiple of alignment in BLKmode case.
Do block move in largest possible alignment.
(store_constructor): Set BITSIZE to -1 for variable size and properly
in case of array of BLKmode.
(expand_expr_unaligned): New function.
(do_compare_and_jump): Call it.
* mips/iris5.h (SWITCHES_NEED_SPACES): New macro.
* collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES
does not include 'o'.
* function.c (instantiate_virtual_regs_1, case SET): Handle case where
both SET_DEST and SET_SRC reference a virtual register.
(gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG.
* integrate.c (expand_inline_function): Handle case of setting
virtual stack vars register (from built in setjmp); when parameter
lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early.
(subst_constant): Add new parm, MEMONLY.
(expand_inline_function, integrate_parm_decls): Pass new parm.
(integrate_decl_tree): Likewise.
(copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P.
(try_constants): Call subst_constants twice, with MEMONLY 0 and 1.
(copy_rtx_and_substitute, case SET): Add explicit calls to
copy_rtx_and_substitute for both sides.
* stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for
constraints.
(pushcase{,_range}): Convert to NOMINAL_TYPE after checking for
within INDEX_TYPE, instead of before.
(fixup_gotos): Use f->target_rtl, not the next insn,
since latter may be from a later fixup.
(expand_value_return): Correctly convert VAL when promoting function
return; support RETURN_REG being a PARALLEL.
(expand_return): When checking for result in regs and having
cleanup, consider PARALLEL in DECL_RTL as being in regs.
From-SVN: r30299
1999-11-01 02:11:22 +01:00
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
for more details.
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
[multiple changes]
Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR>
* gcov.c (DIR_SEPARATOR): Provide default.
(output_data): Add test for MS-DOS format absolute filename.
(fancy_abort): Correct program name.
(open_files): Open all files in binary mode.
* libgcc2.c (__bb_exit_func): Likewise.
* profile.c (init_branch_prob): Specify binary when opening files.
* flags.h (flag_unwind_tables): New decl.
* toplev.c (flag_unwind_table): New definition.
(f_options): Add -funwind-tables.
(decode_g_option): Clarify warning when unknown -g option is given.
(rest_of_compilation): If inside an inlined external function,
pretend we are just being declared.
* dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables.
(dwarf2out_frame_finish): Likewise.
Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com>
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.
Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt>
* fold-const.c (merge_ranges): In not in0, but in1, handle
upper bounds equal like subset case.
Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com>
* dbxout.c (dbxout_parms): Generate a second stabs line for parameters
passed in a register but moved to the stack.
Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr>
* gcc.c (pass_exit_codes, greatest_status): New variables.
(struct option_map): Add entry for "--pass-exit-codes".
(execute): Update greatest_status if error.
(display_help): Add documentation for -pass-exit-codes.
(process_command): Handle -pass-exit-codes.
(main): Look at pass_exit_codes and greatest_status on call to exit.
Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* reload.c (find_reloads): Refine test for no input reload
case to not includes reloads emitted after insn.
* function.c (find_temp_slots_from_address): Handle sum involving
a register that points to a temp slot.
(update_temp_slot_address): Make recursive call if both old and
new are PLUS with a common operand.
* calls.c (expand_call): Mark temp slot for result as having
address taken.
* rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case.
* gcc.c (process_command): Add standard_exec_prefix with "GCC"
component as well as "BINUTILS".
* integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS.
* integrate.c (copy_rtx_and_substitute): Likewise.
(expand_inline_function, integrate_parm_decls, integrate_decl_tree):
All callers changed.
* unroll.c (inital_reg_note_copy, copy_loop_body): Likewise.
* dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use
gdb extensions, write size of type; also be more consistent
in using references when this is a subtype.
* pa.md (extv, extzv, insv): Use define_expand to reject constant
that is out of range.
* loop.c (unknown_constant_address_altered): New variable.
(prescan_loop): Initialize it.
(note_addr_stored): Set it for RTX_UNCHANGING_P MEM.
(invariant_p, case MEM): Remove handling for volatile and readony;
check new variable if readonly.
(check_dbra_loop): Chdeck unknown_constant_address_altered.
* cse.c (canon_hash, case MEM): Do not record if BLKmode.
(addr_affects_sp_p): Removed from note_mem_written and only
define #ifdef AUTO_INC_DEC.
* alpha.c (input_operand, case ADDRESSOF): Treat as REG.
* regclass.c (record_reg_classes): Properly handle register move
directions.
* varasm.c (initializer_constant_valid_p, case MINUS_EXPR):
Don't think valid if both operands are invalid.
(struct constant_descriptor): New field RTL.
(mark_const_hash_entry): Mark it.
(record_constant{,_rtx}): Initialize it.
(output_constant_def): Allocate RTL in permanent obstack and
save in table.
({record,compare}_constant_1): Modes must match for
CONSTRUCTOR of ARRAY_TYPE.
* c-common.h (initializer_constant_valid_p): Delete decl from here.
* output.h (initializer_constant_valid_p): Move decl to here.
* c-common.c (initializer_constant_valid_p): Delete function from here.
* varasm.c (initializer_constant_valid_p): Move function to here.
* tree.h (STRIP_SIGN_NOPS): New macro.
* fold-const.c (optimize_minmax_comparison): New function.
(invert_truthvalue, case WITH_RECORD_EXPR): New case.
(fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS.
(fold, case EQ_EXPR): Call optimize_minmax_comparison and add
cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and
widening conversions.
(fold, case LE_EXPR): Rework changing unsigned to signed comparisons
to look at size of mode, not precision of type; also add missing cases.
(optimize_bit_field_compare, decode_field_reference): Don't try to
optimize COMPONENT_REF of a PLACEHOLDER_EXPR.
* dwarf2out.c (ctype.h): Include.
(dwarf2out_set_demangle_name_func): New function.
(size_of_line_info): Deleted.
(output_line_info): Compute size of line info table from difference
of labels.
(base_type_die, add_name_attribute): Call demangle function, if any.
(field_byte_offset): Use bits per word for variable length fields.
(gen_array_type_die): Add array name.
(gen_subprogram_die): Ignore DECL_INLINE if -fno-inline.
(dwarf2out_add_library_unit_info): New function.
* explow.c (set_stack_check_libfunc): New function.
(stack_check_libfunc): New static variable.
(probe_stack_range): Allow front-end to set up a libfunc to call.
* combine.c (simplify_comparison): When making comparison in wider
mode, check for having commuted an AND and a SUBREG.
(contains_muldiv): New function.
(try_combine): Call it when dividing a PARALLEL.
(simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart.
(simplify_comparison, case ASHIFTRT): Recognize sign-extension of
a PLUS.
(record_value_for_reg): If TEM is a binary operation with two CLOBBERs,
use one of the CLOBBERs instead.
(if_then_else_cond): If comparing against zero, just return thing
being compared.
* optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x).
Don't generate shifts and subtract if have conditional arithmetic.
* rtl.h (delete_barrier): New declaration.
* jump.c (jump_optimize): Set up to handle conditional call.
In conditional arithmetic case, handle CALL_INSN followed by a BARRIER.
(delete_barrier): New function.
* rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode.
* recog.c (nonmemory_operand): Accept ADDRESSOF.
* tree.c (build_type_attribute_variant): Push to obstack of
ttype around type_hash_canon call.
* expr.c (placeholder_list): Move decl to file scope.
(expand_expr): Don't force access to volatile just because its
address is taken.
If ignoring reference operations, just expand the operands.
(expand_expr, case COMPONENT_REF): Propagate
EXPAND_CONST_ADDRESS to recursive call when expanding inner.
Refine test for using bitfield operations vs pointer punning.
(expand_expr, case CONVERT_EXPR): If converting to
BLKmode UNION_TYPE from BLKmode, just return inner object.
Use proper mode in store_field call.
Properly set sizes of object to store and total size in store_field
call for convert to union.
(expand_expr, case ARRAY_REF): If OP0 is in a register, put it in
memory (like for ADDR_EXPR). Also, don't put constant in register if
we'll want it in memory.
(readonly_fields_p): New function.
(expand_expr, case INDIRECT_REF): Call it if LHS.
(expand_assignment): Handle a RESULT_DECL where
DECL_RTL is a PARALLEL.
(do_jump, case WITH_RECORD_EXPR): New case.
(get_inner_reference): Always go inside a CONVERT_EXPR
and NOP_EXPR if both modes are the same.
(store_field): Use bitfield operations if size of bitsize is not same
as size of RHS's type.
Check for bitpos not a multiple of alignment in BLKmode case.
Do block move in largest possible alignment.
(store_constructor): Set BITSIZE to -1 for variable size and properly
in case of array of BLKmode.
(expand_expr_unaligned): New function.
(do_compare_and_jump): Call it.
* mips/iris5.h (SWITCHES_NEED_SPACES): New macro.
* collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES
does not include 'o'.
* function.c (instantiate_virtual_regs_1, case SET): Handle case where
both SET_DEST and SET_SRC reference a virtual register.
(gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG.
* integrate.c (expand_inline_function): Handle case of setting
virtual stack vars register (from built in setjmp); when parameter
lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early.
(subst_constant): Add new parm, MEMONLY.
(expand_inline_function, integrate_parm_decls): Pass new parm.
(integrate_decl_tree): Likewise.
(copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P.
(try_constants): Call subst_constants twice, with MEMONLY 0 and 1.
(copy_rtx_and_substitute, case SET): Add explicit calls to
copy_rtx_and_substitute for both sides.
* stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for
constraints.
(pushcase{,_range}): Convert to NOMINAL_TYPE after checking for
within INDEX_TYPE, instead of before.
(fixup_gotos): Use f->target_rtl, not the next insn,
since latter may be from a later fixup.
(expand_value_return): Correctly convert VAL when promoting function
return; support RETURN_REG being a PARALLEL.
(expand_return): When checking for result in regs and having
cleanup, consider PARALLEL in DECL_RTL as being in regs.
From-SVN: r30299
1999-11-01 02:11:22 +01:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 16:35:51 +02:00
|
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
2005-06-25 04:02:01 +02:00
|
|
|
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
|
02110-1301, USA. */
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
|
|
/* Generic garbage collection (GC) functions and data, not specific to
|
|
|
|
|
any particular GC implementation. */
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
2001-09-20 17:12:54 +02:00
|
|
|
|
#include "hashtab.h"
|
1999-10-05 17:42:18 +02:00
|
|
|
|
#include "ggc.h"
|
2003-01-10 03:22:34 +01:00
|
|
|
|
#include "toplev.h"
|
2003-02-22 04:08:47 +01:00
|
|
|
|
#include "params.h"
|
2003-07-30 01:36:53 +02:00
|
|
|
|
#include "hosthooks.h"
|
2004-03-11 04:19:04 +01:00
|
|
|
|
#include "hosthooks-def.h"
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
2003-02-23 17:56:04 +01:00
|
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
|
# include <sys/resource.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
#ifdef HAVE_MMAP_FILE
|
|
|
|
|
# include <sys/mman.h>
|
2003-06-08 08:41:28 +02:00
|
|
|
|
# ifdef HAVE_MINCORE
|
|
|
|
|
/* This is on Solaris. */
|
|
|
|
|
# include <sys/types.h>
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef MAP_FAILED
|
|
|
|
|
# define MAP_FAILED ((void *)-1)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
#endif
|
|
|
|
|
|
2002-11-20 21:06:34 +01:00
|
|
|
|
#ifdef ENABLE_VALGRIND_CHECKING
|
2003-10-29 23:13:59 +01:00
|
|
|
|
# ifdef HAVE_VALGRIND_MEMCHECK_H
|
|
|
|
|
# include <valgrind/memcheck.h>
|
|
|
|
|
# elif defined HAVE_MEMCHECK_H
|
|
|
|
|
# include <memcheck.h>
|
2003-03-04 18:51:00 +01:00
|
|
|
|
# else
|
2003-10-29 23:13:59 +01:00
|
|
|
|
# include <valgrind.h>
|
2003-03-04 18:51:00 +01:00
|
|
|
|
# endif
|
2002-11-20 21:06:34 +01:00
|
|
|
|
#else
|
|
|
|
|
/* Avoid #ifdef:s when we can help it. */
|
|
|
|
|
#define VALGRIND_DISCARD(x)
|
|
|
|
|
#endif
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
2004-09-02 20:32:49 +02:00
|
|
|
|
/* When set, ggc_collect will do collection. */
|
|
|
|
|
bool ggc_force_collect;
|
|
|
|
|
|
1999-10-29 06:17:33 +02:00
|
|
|
|
/* Statistics about the allocation. */
|
|
|
|
|
static ggc_statistics *ggc_stats;
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
struct traversal_state;
|
|
|
|
|
|
2003-06-07 20:35:35 +02:00
|
|
|
|
static int ggc_htab_delete (void **, void *);
|
|
|
|
|
static hashval_t saving_htab_hash (const void *);
|
|
|
|
|
static int saving_htab_eq (const void *, const void *);
|
|
|
|
|
static int call_count (void **, void *);
|
|
|
|
|
static int call_alloc (void **, void *);
|
|
|
|
|
static int compare_ptr_data (const void *, const void *);
|
|
|
|
|
static void relocate_ptrs (void *, void *);
|
|
|
|
|
static void write_pch_globals (const struct ggc_root_tab * const *tab,
|
|
|
|
|
struct traversal_state *state);
|
|
|
|
|
static double ggc_rlimit_bound (double);
|
1999-09-11 21:48:37 +02:00
|
|
|
|
|
|
|
|
|
/* Maintain global roots that are preserved during GC. */
|
|
|
|
|
|
2001-09-20 17:12:54 +02:00
|
|
|
|
/* Process a slot of an htab by deleting it if it has not been marked. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_htab_delete (void **slot, void *info)
|
2001-09-20 17:12:54 +02:00
|
|
|
|
{
|
2002-06-04 09:11:05 +02:00
|
|
|
|
const struct ggc_cache_tab *r = (const struct ggc_cache_tab *) info;
|
2001-09-20 17:12:54 +02:00
|
|
|
|
|
|
|
|
|
if (! (*r->marked_p) (*slot))
|
2002-06-04 09:11:05 +02:00
|
|
|
|
htab_clear_slot (*r->base, slot);
|
|
|
|
|
else
|
|
|
|
|
(*r->cb) (*slot);
|
2001-09-20 17:12:54 +02:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-30 23:36:13 +02:00
|
|
|
|
/* Iterate through all registered roots and mark each element. */
|
|
|
|
|
|
1999-09-11 21:48:37 +02:00
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_mark_roots (void)
|
1999-09-16 21:27:01 +02:00
|
|
|
|
{
|
2002-06-04 09:11:05 +02:00
|
|
|
|
const struct ggc_root_tab *const *rt;
|
|
|
|
|
const struct ggc_root_tab *rti;
|
|
|
|
|
const struct ggc_cache_tab *const *ct;
|
|
|
|
|
const struct ggc_cache_tab *cti;
|
|
|
|
|
size_t i;
|
2002-06-04 13:30:46 +02:00
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
for (rt = gt_ggc_deletable_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
memset (rti->base, 0, rti->stride);
|
|
|
|
|
|
|
|
|
|
for (rt = gt_ggc_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
(*rti->cb)(*(void **)((char *)rti->base + rti->stride * i));
|
2000-04-06 02:51:25 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
ggc_mark_stringpool ();
|
2000-04-06 02:51:25 +02:00
|
|
|
|
|
2001-09-20 17:12:54 +02:00
|
|
|
|
/* Now scan all hash tables that have objects which are to be deleted if
|
2002-06-04 09:11:05 +02:00
|
|
|
|
they are not already marked. */
|
|
|
|
|
for (ct = gt_ggc_cache_rtab; *ct; ct++)
|
|
|
|
|
for (cti = *ct; cti->base != NULL; cti++)
|
2002-09-13 23:54:10 +02:00
|
|
|
|
if (*cti->base)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
ggc_set_mark (*cti->base);
|
2003-06-07 20:35:35 +02:00
|
|
|
|
htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
ggc_set_mark ((*cti->base)->entries);
|
|
|
|
|
}
|
1999-09-16 21:27:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
/* Allocate a block of memory, then clear it. */
|
|
|
|
|
void *
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
|
2000-01-25 11:47:46 +01:00
|
|
|
|
{
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
void *buf = ggc_alloc_stat (size PASS_MEM_STAT);
|
2002-06-04 09:11:05 +02:00
|
|
|
|
memset (buf, 0, size);
|
|
|
|
|
return buf;
|
2000-01-25 11:47:46 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
/* Resize a block of memory, possibly re-allocating it. */
|
|
|
|
|
void *
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
|
2000-01-25 11:47:46 +01:00
|
|
|
|
{
|
2002-06-04 09:11:05 +02:00
|
|
|
|
void *r;
|
|
|
|
|
size_t old_size;
|
2000-01-25 11:47:46 +01:00
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
if (x == NULL)
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
return ggc_alloc_stat (size PASS_MEM_STAT);
|
2000-01-25 11:47:46 +01:00
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
old_size = ggc_get_size (x);
|
2004-01-28 19:49:26 +01:00
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
if (size <= old_size)
|
2002-11-20 21:06:34 +01:00
|
|
|
|
{
|
|
|
|
|
/* Mark the unwanted memory as unaccessible. We also need to make
|
|
|
|
|
the "new" size accessible, since ggc_get_size returns the size of
|
|
|
|
|
the pool, not the size of the individually allocated object, the
|
|
|
|
|
size which was previously made accessible. Unfortunately, we
|
|
|
|
|
don't know that previously allocated size. Without that
|
|
|
|
|
knowledge we have to lose some initialization-tracking for the
|
|
|
|
|
old parts of the object. An alternative is to mark the whole
|
2003-06-07 20:35:35 +02:00
|
|
|
|
old_size as reachable, but that would lose tracking of writes
|
2002-11-20 21:06:34 +01:00
|
|
|
|
after the end of the object (by small offsets). Discard the
|
|
|
|
|
handle to avoid handle leak. */
|
|
|
|
|
VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS ((char *) x + size,
|
|
|
|
|
old_size - size));
|
|
|
|
|
VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (x, size));
|
|
|
|
|
return x;
|
|
|
|
|
}
|
2000-01-25 11:47:46 +01:00
|
|
|
|
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
r = ggc_alloc_stat (size PASS_MEM_STAT);
|
2002-11-20 21:06:34 +01:00
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
that were marked invalid with the memcpy below. We lose a bit of the
|
|
|
|
|
initialization-tracking since some of it may be uninitialized. */
|
|
|
|
|
VALGRIND_DISCARD (VALGRIND_MAKE_READABLE (x, old_size));
|
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
memcpy (r, x, old_size);
|
2002-11-20 21:06:34 +01:00
|
|
|
|
|
|
|
|
|
/* The old object is not supposed to be used anymore. */
|
2004-01-28 19:49:26 +01:00
|
|
|
|
ggc_free (x);
|
2002-11-20 21:06:34 +01:00
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
return r;
|
2000-01-25 11:47:46 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-06-04 09:11:05 +02:00
|
|
|
|
/* Like ggc_alloc_cleared, but performs a multiplication. */
|
ggc-none.c, [...] (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory.
toplevel:
* ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename
it ggc_alloc, drop second argument, never clear returned memory.
* ggc-common.c (ggc_alloc_string): Use ggc_alloc.
(ggc_alloc_cleared): New.
* ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not
ggc_alloc_obj. Remove ggc_alloc macro.
(ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc.
* rtl.c (rtvec_alloc): Clear the vector always.
(rtx_alloc): Clear the first word always. Remove dirty
obstack tricks (this routine is no longer a bottleneck).
* tree.c (make_node): Clear the new node always.
(make_tree_vec): Likewise.
(tree_cons): Clear the common structure always.
(build1): Likewise; also, clear TREE_COMPLEXITY.
* gengenrtl.c: Use puts wherever possible. Remove extra
newlines.
(gendef): Clear the first word of an RTX in the generator
function, irrespective of ggc_p. Initialize '0' slots to
NULL.
(genlegend): Don't generate obstack_alloc_rtx routine, just a
thin wrapper macro around obstack_alloc.
* stmt.c (expand_fixup): Use ggc_alloc.
* c-typeck.c (add_pending_init): Use ggc_alloc.
* emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem).
* varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to
const0_rtx when it is created.
(immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if
we are not in a function.
* tree.c (tree_class_check_failed): Make second arg an int.
* tree.h: Update prototype.
cp:
* call.c (add_candidate): Use ggc_alloc_cleared.
* decl.c (lookup_label): Likewise.
* lex.c (retrofit_lang_decl): Likewise.
From-SVN: r34478
2000-06-09 23:47:40 +02:00
|
|
|
|
void *
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_calloc (size_t s1, size_t s2)
|
ggc-none.c, [...] (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory.
toplevel:
* ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename
it ggc_alloc, drop second argument, never clear returned memory.
* ggc-common.c (ggc_alloc_string): Use ggc_alloc.
(ggc_alloc_cleared): New.
* ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not
ggc_alloc_obj. Remove ggc_alloc macro.
(ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc.
* rtl.c (rtvec_alloc): Clear the vector always.
(rtx_alloc): Clear the first word always. Remove dirty
obstack tricks (this routine is no longer a bottleneck).
* tree.c (make_node): Clear the new node always.
(make_tree_vec): Likewise.
(tree_cons): Clear the common structure always.
(build1): Likewise; also, clear TREE_COMPLEXITY.
* gengenrtl.c: Use puts wherever possible. Remove extra
newlines.
(gendef): Clear the first word of an RTX in the generator
function, irrespective of ggc_p. Initialize '0' slots to
NULL.
(genlegend): Don't generate obstack_alloc_rtx routine, just a
thin wrapper macro around obstack_alloc.
* stmt.c (expand_fixup): Use ggc_alloc.
* c-typeck.c (add_pending_init): Use ggc_alloc.
* emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem).
* varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to
const0_rtx when it is created.
(immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if
we are not in a function.
* tree.c (tree_class_check_failed): Make second arg an int.
* tree.h: Update prototype.
cp:
* call.c (add_candidate): Use ggc_alloc_cleared.
* decl.c (lookup_label): Likewise.
* lex.c (retrofit_lang_decl): Likewise.
From-SVN: r34478
2000-06-09 23:47:40 +02:00
|
|
|
|
{
|
2002-06-04 09:11:05 +02:00
|
|
|
|
return ggc_alloc_cleared (s1 * s2);
|
ggc-none.c, [...] (ggc_alloc_obj): Rename it ggc_alloc, drop second argument, never clear returned memory.
toplevel:
* ggc-none.c, ggc-simple.c, ggc-page.c (ggc_alloc_obj): Rename
it ggc_alloc, drop second argument, never clear returned memory.
* ggc-common.c (ggc_alloc_string): Use ggc_alloc.
(ggc_alloc_cleared): New.
* ggc.h: Prototype ggc_alloc and ggc_alloc_cleared, not
ggc_alloc_obj. Remove ggc_alloc macro.
(ggc_alloc_rtx, ggc_alloc_rtvec, ggc_alloc_tree): Use ggc_alloc.
* rtl.c (rtvec_alloc): Clear the vector always.
(rtx_alloc): Clear the first word always. Remove dirty
obstack tricks (this routine is no longer a bottleneck).
* tree.c (make_node): Clear the new node always.
(make_tree_vec): Likewise.
(tree_cons): Clear the common structure always.
(build1): Likewise; also, clear TREE_COMPLEXITY.
* gengenrtl.c: Use puts wherever possible. Remove extra
newlines.
(gendef): Clear the first word of an RTX in the generator
function, irrespective of ggc_p. Initialize '0' slots to
NULL.
(genlegend): Don't generate obstack_alloc_rtx routine, just a
thin wrapper macro around obstack_alloc.
* stmt.c (expand_fixup): Use ggc_alloc.
* c-typeck.c (add_pending_init): Use ggc_alloc.
* emit-rtl.c (init_emit_once): Clear CONST_DOUBLE_CHAIN(tem).
* varasm.c (immed_double_const): Set CONST_DOUBLE_MEM(r) to
const0_rtx when it is created.
(immed_real_const_1): Set CONST_DOUBLE_CHAIN(r) to NULL_RTX if
we are not in a function.
* tree.c (tree_class_check_failed): Make second arg an int.
* tree.h: Update prototype.
cp:
* call.c (add_candidate): Use ggc_alloc_cleared.
* decl.c (lookup_label): Likewise.
* lex.c (retrofit_lang_decl): Likewise.
From-SVN: r34478
2000-06-09 23:47:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
/* These are for splay_tree_new_ggc. */
|
2003-06-07 20:35:35 +02:00
|
|
|
|
void *
|
|
|
|
|
ggc_splay_alloc (int sz, void *nl)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert (!nl);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
return ggc_alloc (sz);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_splay_dont_free (void * x ATTRIBUTE_UNUSED, void *nl)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert (!nl);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-29 06:17:33 +02:00
|
|
|
|
/* Print statistics that are independent of the collector in use. */
|
2000-08-29 22:57:11 +02:00
|
|
|
|
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
|
|
|
|
|
? (x) \
|
|
|
|
|
: ((x) < 1024*1024*10 \
|
|
|
|
|
? (x) / 1024 \
|
|
|
|
|
: (x) / (1024*1024))))
|
|
|
|
|
#define LABEL(x) ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_print_common_statistics (FILE *stream ATTRIBUTE_UNUSED,
|
|
|
|
|
ggc_statistics *stats)
|
1999-10-29 06:17:33 +02:00
|
|
|
|
{
|
|
|
|
|
/* Set the pointer so that during collection we will actually gather
|
|
|
|
|
the statistics. */
|
|
|
|
|
ggc_stats = stats;
|
|
|
|
|
|
|
|
|
|
/* Then do one collection to fill in the statistics. */
|
|
|
|
|
ggc_collect ();
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
/* At present, we don't really gather any interesting statistics. */
|
|
|
|
|
|
|
|
|
|
/* Don't gather statistics any more. */
|
|
|
|
|
ggc_stats = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Functions for saving and restoring GCable memory to disk. */
|
|
|
|
|
|
|
|
|
|
static htab_t saving_htab;
|
|
|
|
|
|
2003-06-07 20:35:35 +02:00
|
|
|
|
struct ptr_data
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
void *obj;
|
|
|
|
|
void *note_ptr_cookie;
|
|
|
|
|
gt_note_pointers note_ptr_fn;
|
|
|
|
|
gt_handle_reorder reorder_fn;
|
|
|
|
|
size_t size;
|
|
|
|
|
void *new_addr;
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
enum gt_types_enum type;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define POINTER_HASH(x) (hashval_t)((long)x >> 3)
|
|
|
|
|
|
|
|
|
|
/* Register an object in the hash table. */
|
|
|
|
|
|
|
|
|
|
int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
gt_pch_note_object (void *obj, void *note_ptr_cookie,
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
gt_note_pointers note_ptr_fn,
|
|
|
|
|
enum gt_types_enum type)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
struct ptr_data **slot;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
if (obj == NULL || obj == (void *) 1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
slot = (struct ptr_data **)
|
|
|
|
|
htab_find_slot_with_hash (saving_htab, obj, POINTER_HASH (obj),
|
|
|
|
|
INSERT);
|
|
|
|
|
if (*slot != NULL)
|
|
|
|
|
{
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert ((*slot)->note_ptr_fn == note_ptr_fn
|
|
|
|
|
&& (*slot)->note_ptr_cookie == note_ptr_cookie);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
*slot = xcalloc (sizeof (struct ptr_data), 1);
|
|
|
|
|
(*slot)->obj = obj;
|
|
|
|
|
(*slot)->note_ptr_fn = note_ptr_fn;
|
|
|
|
|
(*slot)->note_ptr_cookie = note_ptr_cookie;
|
|
|
|
|
if (note_ptr_fn == gt_pch_p_S)
|
|
|
|
|
(*slot)->size = strlen (obj) + 1;
|
|
|
|
|
else
|
|
|
|
|
(*slot)->size = ggc_get_size (obj);
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
(*slot)->type = type;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Register an object in the hash table. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
gt_pch_note_reorder (void *obj, void *note_ptr_cookie,
|
|
|
|
|
gt_handle_reorder reorder_fn)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
struct ptr_data *data;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
if (obj == NULL || obj == (void *) 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
data = htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj));
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert (data && data->note_ptr_cookie == note_ptr_cookie);
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
data->reorder_fn = reorder_fn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Hash and equality functions for saving_htab, callbacks for htab_create. */
|
|
|
|
|
|
|
|
|
|
static hashval_t
|
2003-06-07 20:35:35 +02:00
|
|
|
|
saving_htab_hash (const void *p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
return POINTER_HASH (((struct ptr_data *)p)->obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
saving_htab_eq (const void *p1, const void *p2)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
return ((struct ptr_data *)p1)->obj == p2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handy state for the traversal functions. */
|
|
|
|
|
|
2003-06-07 20:35:35 +02:00
|
|
|
|
struct traversal_state
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
|
|
|
|
struct ggc_pch_data *d;
|
|
|
|
|
size_t count;
|
|
|
|
|
struct ptr_data **ptrs;
|
|
|
|
|
size_t ptrs_i;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Callbacks for htab_traverse. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
call_count (void **slot, void *state_p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
struct ptr_data *d = (struct ptr_data *)*slot;
|
|
|
|
|
struct traversal_state *state = (struct traversal_state *)state_p;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
ggc_pch_count_object (state->d, d->obj, d->size,
|
|
|
|
|
d->note_ptr_fn == gt_pch_p_S,
|
|
|
|
|
d->type);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
state->count++;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
call_alloc (void **slot, void *state_p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
struct ptr_data *d = (struct ptr_data *)*slot;
|
|
|
|
|
struct traversal_state *state = (struct traversal_state *)state_p;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
d->new_addr = ggc_pch_alloc_object (state->d, d->obj, d->size,
|
|
|
|
|
d->note_ptr_fn == gt_pch_p_S,
|
|
|
|
|
d->type);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
state->ptrs[state->ptrs_i++] = d;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Callback for qsort. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
compare_ptr_data (const void *p1_p, const void *p2_p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
struct ptr_data *p1 = *(struct ptr_data *const *)p1_p;
|
|
|
|
|
struct ptr_data *p2 = *(struct ptr_data *const *)p2_p;
|
|
|
|
|
return (((size_t)p1->new_addr > (size_t)p2->new_addr)
|
|
|
|
|
- ((size_t)p1->new_addr < (size_t)p2->new_addr));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Callbacks for note_ptr_fn. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
relocate_ptrs (void *ptr_p, void *state_p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
void **ptr = (void **)ptr_p;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
struct traversal_state *state ATTRIBUTE_UNUSED
|
2003-01-10 03:22:34 +01:00
|
|
|
|
= (struct traversal_state *)state_p;
|
|
|
|
|
struct ptr_data *result;
|
|
|
|
|
|
|
|
|
|
if (*ptr == NULL || *ptr == (void *)1)
|
|
|
|
|
return;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
result = htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr));
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert (result);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
*ptr = result->new_addr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out, after relocation, the pointers in TAB. */
|
|
|
|
|
static void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
write_pch_globals (const struct ggc_root_tab * const *tab,
|
|
|
|
|
struct traversal_state *state)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
const struct ggc_root_tab *const *rt;
|
|
|
|
|
const struct ggc_root_tab *rti;
|
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
|
|
for (rt = tab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
{
|
|
|
|
|
void *ptr = *(void **)((char *)rti->base + rti->stride * i);
|
|
|
|
|
struct ptr_data *new_ptr;
|
|
|
|
|
if (ptr == NULL || ptr == (void *)1)
|
|
|
|
|
{
|
2003-06-07 20:35:35 +02:00
|
|
|
|
if (fwrite (&ptr, sizeof (void *), 1, state->f)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
!= 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't write PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-06-07 20:35:35 +02:00
|
|
|
|
new_ptr = htab_find_with_hash (saving_htab, ptr,
|
2003-01-10 03:22:34 +01:00
|
|
|
|
POINTER_HASH (ptr));
|
2003-06-07 20:35:35 +02:00
|
|
|
|
if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
!= 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't write PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Hold the information we need to mmap the file back in. */
|
|
|
|
|
|
2003-06-07 20:35:35 +02:00
|
|
|
|
struct mmap_info
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
size_t offset;
|
|
|
|
|
size_t size;
|
|
|
|
|
void *preferred_base;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Write out the state of the compiler to F. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
gt_pch_save (FILE *f)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
const struct ggc_root_tab *const *rt;
|
|
|
|
|
const struct ggc_root_tab *rti;
|
|
|
|
|
size_t i;
|
|
|
|
|
struct traversal_state state;
|
|
|
|
|
char *this_object = NULL;
|
|
|
|
|
size_t this_object_size = 0;
|
|
|
|
|
struct mmap_info mmi;
|
2004-06-05 09:28:27 +02:00
|
|
|
|
const size_t mmap_offset_alignment = host_hooks.gt_pch_alloc_granularity();
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
gt_pch_save_stringpool ();
|
|
|
|
|
|
|
|
|
|
saving_htab = htab_create (50000, saving_htab_hash, saving_htab_eq, free);
|
|
|
|
|
|
|
|
|
|
for (rt = gt_ggc_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
(*rti->pchw)(*(void **)((char *)rti->base + rti->stride * i));
|
|
|
|
|
|
|
|
|
|
for (rt = gt_pch_cache_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
(*rti->pchw)(*(void **)((char *)rti->base + rti->stride * i));
|
|
|
|
|
|
|
|
|
|
/* Prepare the objects for writing, determine addresses and such. */
|
|
|
|
|
state.f = f;
|
|
|
|
|
state.d = init_ggc_pch();
|
|
|
|
|
state.count = 0;
|
|
|
|
|
htab_traverse (saving_htab, call_count, &state);
|
|
|
|
|
|
|
|
|
|
mmi.size = ggc_pch_total_size (state.d);
|
|
|
|
|
|
2003-07-30 01:36:53 +02:00
|
|
|
|
/* Try to arrange things so that no relocation is necessary, but
|
|
|
|
|
don't try very hard. On most platforms, this will always work,
|
|
|
|
|
and on the rest it's a lot of work to do better.
|
|
|
|
|
(The extra work goes in HOST_HOOKS_GT_PCH_GET_ADDRESS and
|
|
|
|
|
HOST_HOOKS_GT_PCH_USE_ADDRESS.) */
|
2004-03-11 04:19:04 +01:00
|
|
|
|
mmi.preferred_base = host_hooks.gt_pch_get_address (mmi.size, fileno (f));
|
2003-07-30 01:36:53 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
ggc_pch_this_base (state.d, mmi.preferred_base);
|
|
|
|
|
|
2006-01-31 20:56:55 +01:00
|
|
|
|
state.ptrs = XNEWVEC (struct ptr_data *, state.count);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
state.ptrs_i = 0;
|
|
|
|
|
htab_traverse (saving_htab, call_alloc, &state);
|
|
|
|
|
qsort (state.ptrs, state.count, sizeof (*state.ptrs), compare_ptr_data);
|
|
|
|
|
|
|
|
|
|
/* Write out all the scalar variables. */
|
|
|
|
|
for (rt = gt_pch_scalar_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
if (fwrite (rti->base, rti->stride, 1, f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't write PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
/* Write out all the global pointers, after translation. */
|
|
|
|
|
write_pch_globals (gt_ggc_rtab, &state);
|
|
|
|
|
write_pch_globals (gt_pch_cache_rtab, &state);
|
|
|
|
|
|
2004-06-05 09:28:27 +02:00
|
|
|
|
/* Pad the PCH file so that the mmapped area starts on an allocation
|
|
|
|
|
granularity (usually page) boundary. */
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
2003-01-12 17:44:09 +01:00
|
|
|
|
long o;
|
|
|
|
|
o = ftell (state.f) + sizeof (mmi);
|
|
|
|
|
if (o == -1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't get position in PCH file: %m");
|
2004-06-05 09:28:27 +02:00
|
|
|
|
mmi.offset = mmap_offset_alignment - o % mmap_offset_alignment;
|
|
|
|
|
if (mmi.offset == mmap_offset_alignment)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
mmi.offset = 0;
|
|
|
|
|
mmi.offset += o;
|
|
|
|
|
}
|
|
|
|
|
if (fwrite (&mmi, sizeof (mmi), 1, state.f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't write PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
if (mmi.offset != 0
|
|
|
|
|
&& fseek (state.f, mmi.offset, SEEK_SET) != 0)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't write padding to PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
ggc-zone.c: Rewritten.
* ggc-zone.c: Rewritten.
* alloc-pool.c (dump_alloc_pool_statistics): Don't print statistics
if there are none.
* configure.ac: Define GGC_ZONE for --with-gc=zone.
* config.in: Regenerated.
* configure: Regenerated.
* gentype.c (write_types_process_field, write_func_for_structure):
Pass new argument to gt_pch_note_object.
* ggc-common.c (struct ptr_data): Add TYPE.
(gt_pch_note_object): Take TYPE argument and save it.
(call_count): Update call to ggc_pch_count_object.
(call_alloc): Update call to ggc_pch_alloc_object.
(gt_pch_save): Call ggc_pch_prepare_write after paddng the PCH
file.
* ggc-none.c (rtl_zone, garbage_zone, ggc_alloc_zone_stat): Delete.
* ggc-page.c (rtl_zone, tree_zone, garbage_zone)
(ggc_alloc_zone_stat): Delete.
(ggc_pch_count_object, ggc_pch_alloc_object): Add TYPE argument.
* ggc.h (gt_pch_note_object, ggc_pch_count_object)
(ggc_pch_alloc_object): Update prototypes.
(garbage_zone): Delete.
(tree_zone, rtl_zone, ggc_alloc_zone_stat, ggc_alloc_zone): Move to
GGC_ZONE conditional. Update. Change tree_zone and rtl_zone into
pointers.
(tree_id_zone): New variable.
(ggc_alloc_cleared_zone): Remove unused.
(ggc_alloc_zone): Define.
(ggc_alloc_rtvec, ggc_alloc_tree): Update to use ggc_alloc_zone.
* rtl.c (rtx_alloc_stat, shallow_copy_rtx_stat): Use
ggc_alloc_zone_stat.
* stringpool.c (gt_pch_n_S): Update call to gt_pch_note_object.
* tree.c (copy_node_stat, make_tree_binfo_stat, make_tree_vec_stat)
(tree_cons_stat, build1_stat): Update call to ggc_alloc_zone_stat.
(make_node_stat): Likewise. Use tree_id_zone.
From-SVN: r96381
2005-03-13 19:09:55 +01:00
|
|
|
|
ggc_pch_prepare_write (state.d, state.f);
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
/* Actually write out the objects. */
|
|
|
|
|
for (i = 0; i < state.count; i++)
|
1999-10-29 06:17:33 +02:00
|
|
|
|
{
|
2003-01-10 03:22:34 +01:00
|
|
|
|
if (this_object_size < state.ptrs[i]->size)
|
|
|
|
|
{
|
|
|
|
|
this_object_size = state.ptrs[i]->size;
|
|
|
|
|
this_object = xrealloc (this_object, this_object_size);
|
|
|
|
|
}
|
|
|
|
|
memcpy (this_object, state.ptrs[i]->obj, state.ptrs[i]->size);
|
|
|
|
|
if (state.ptrs[i]->reorder_fn != NULL)
|
2003-06-07 20:35:35 +02:00
|
|
|
|
state.ptrs[i]->reorder_fn (state.ptrs[i]->obj,
|
2003-01-10 03:22:34 +01:00
|
|
|
|
state.ptrs[i]->note_ptr_cookie,
|
|
|
|
|
relocate_ptrs, &state);
|
2003-06-07 20:35:35 +02:00
|
|
|
|
state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj,
|
2003-01-10 03:22:34 +01:00
|
|
|
|
state.ptrs[i]->note_ptr_cookie,
|
|
|
|
|
relocate_ptrs, &state);
|
|
|
|
|
ggc_pch_write_object (state.d, state.f, state.ptrs[i]->obj,
|
2004-03-11 04:19:04 +01:00
|
|
|
|
state.ptrs[i]->new_addr, state.ptrs[i]->size,
|
|
|
|
|
state.ptrs[i]->note_ptr_fn == gt_pch_p_S);
|
2003-01-10 03:22:34 +01:00
|
|
|
|
if (state.ptrs[i]->note_ptr_fn != gt_pch_p_S)
|
|
|
|
|
memcpy (state.ptrs[i]->obj, this_object, state.ptrs[i]->size);
|
1999-10-29 06:17:33 +02:00
|
|
|
|
}
|
2003-01-10 03:22:34 +01:00
|
|
|
|
ggc_pch_finish (state.d, state.f);
|
2003-04-03 23:00:56 +02:00
|
|
|
|
gt_pch_fixup_stringpool ();
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
free (state.ptrs);
|
|
|
|
|
htab_delete (saving_htab);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the state of the compiler back in from F. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
gt_pch_restore (FILE *f)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
const struct ggc_root_tab *const *rt;
|
|
|
|
|
const struct ggc_root_tab *rti;
|
|
|
|
|
size_t i;
|
|
|
|
|
struct mmap_info mmi;
|
2004-03-11 04:19:04 +01:00
|
|
|
|
int result;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
/* Delete any deletable objects. This makes ggc_pch_read much
|
|
|
|
|
faster, as it can be sure that no GCable objects remain other
|
|
|
|
|
than the ones just read in. */
|
|
|
|
|
for (rt = gt_ggc_deletable_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
memset (rti->base, 0, rti->stride);
|
|
|
|
|
|
|
|
|
|
/* Read in all the scalar variables. */
|
|
|
|
|
for (rt = gt_pch_scalar_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
if (fread (rti->base, rti->stride, 1, f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
/* Read in all the global pointers, in 6 easy loops. */
|
|
|
|
|
for (rt = gt_ggc_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
if (fread ((char *)rti->base + rti->stride * i,
|
|
|
|
|
sizeof (void *), 1, f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
for (rt = gt_pch_cache_rtab; *rt; rt++)
|
|
|
|
|
for (rti = *rt; rti->base != NULL; rti++)
|
|
|
|
|
for (i = 0; i < rti->nelt; i++)
|
|
|
|
|
if (fread ((char *)rti->base + rti->stride * i,
|
|
|
|
|
sizeof (void *), 1, f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
|
|
|
|
if (fread (&mmi, sizeof (mmi), 1, f) != 1)
|
diagnostic.c (output_format): Add support for %m.
* diagnostic.c (output_format): Add support for %m.
(output_printf, output_verbatim, diagnostic_set_info,
verbatim): Set err_no field of the text_info structure being
initialized.
(fatal_io_error): Delete function.
* diagnostic.h (text_info): Add err_no field.
* toplev.h (fatal_io_error): Delete prototype.
* c-opts.c, c-pch.c, dwarfout.c, ggc-common.c, ggc-page.c, graph.c
* toplev.c, config/mips/mips.c, config/rs6000/host-darwin.c
* f/com.c, java/jcf-parse.c, java/jcf-write.c, java/lex.c
* objc/objc-act.c: Replace all calls to fatal_io_error with
calls to fatal_error; add ": %m" to the end of all the affected
error messages.
From-SVN: r66769
2003-05-13 20:06:52 +02:00
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size,
|
|
|
|
|
fileno (f), mmi.offset);
|
|
|
|
|
if (result < 0)
|
|
|
|
|
fatal_error ("had to relocate PCH");
|
|
|
|
|
if (result == 0)
|
2003-07-30 01:36:53 +02:00
|
|
|
|
{
|
2004-03-11 04:19:04 +01:00
|
|
|
|
if (fseek (f, mmi.offset, SEEK_SET) != 0
|
|
|
|
|
|| fread (mmi.preferred_base, mmi.size, 1, f) != 1)
|
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
|
|
|
|
}
|
|
|
|
|
else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0)
|
|
|
|
|
fatal_error ("can't read PCH file: %m");
|
2003-06-08 08:41:28 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
ggc_pch_read (f, mmi.preferred_base);
|
2003-07-30 01:36:53 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
gt_pch_restore_stringpool ();
|
|
|
|
|
}
|
2003-07-30 01:36:53 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
/* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is not present.
|
|
|
|
|
Select no address whatsoever, and let gt_pch_save choose what it will with
|
|
|
|
|
malloc, presumably. */
|
2004-03-05 02:22:58 +01:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
void *
|
|
|
|
|
default_gt_pch_get_address (size_t size ATTRIBUTE_UNUSED,
|
|
|
|
|
int fd ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2004-03-05 02:22:58 +01:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
/* Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is not present.
|
|
|
|
|
Allocate SIZE bytes with malloc. Return 0 if the address we got is the
|
|
|
|
|
same as base, indicating that the memory has been allocated but needs to
|
|
|
|
|
be read in from the file. Return -1 if the address differs, to relocation
|
|
|
|
|
of the PCH file would be required. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
default_gt_pch_use_address (void *base, size_t size, int fd ATTRIBUTE_UNUSED,
|
|
|
|
|
size_t offset ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
void *addr = xmalloc (size);
|
|
|
|
|
return (addr == base) - 1;
|
|
|
|
|
}
|
2004-03-05 02:22:58 +01:00
|
|
|
|
|
2004-06-05 09:28:27 +02:00
|
|
|
|
/* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS. Return the
|
|
|
|
|
alignment required for allocating virtual memory. Usually this is the
|
|
|
|
|
same as pagesize. */
|
|
|
|
|
|
|
|
|
|
size_t
|
|
|
|
|
default_gt_pch_alloc_granularity (void)
|
|
|
|
|
{
|
|
|
|
|
return getpagesize();
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
#if HAVE_MMAP_FILE
|
|
|
|
|
/* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is present.
|
|
|
|
|
We temporarily allocate SIZE bytes, and let the kernel place the data
|
c-common.c, [...]: Fix comment typos.
* c-common.c, cfgcleanup.c, cgraphunit.c, c-pretty-print.c,
expmed.c, ggc-common.c, jump.c, passes.c, recog.c, regmove.c,
reorg.c, tree.h: Fix comment typos.
From-SVN: r79730
2004-03-20 06:21:41 +01:00
|
|
|
|
wherever it will. If it worked, that's our spot, if not we're likely
|
2004-03-11 04:19:04 +01:00
|
|
|
|
to be in trouble. */
|
2003-06-08 08:41:28 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
void *
|
|
|
|
|
mmap_gt_pch_get_address (size_t size, int fd)
|
|
|
|
|
{
|
|
|
|
|
void *ret;
|
2003-07-30 01:36:53 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
ret = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
|
|
|
|
|
if (ret == (void *) MAP_FAILED)
|
|
|
|
|
ret = NULL;
|
|
|
|
|
else
|
|
|
|
|
munmap (ret, size);
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
1999-10-29 06:17:33 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
/* Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is present.
|
|
|
|
|
Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at
|
|
|
|
|
mapping the data at BASE, -1 if we couldn't.
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
This version assumes that the kernel honors the START operand of mmap
|
|
|
|
|
even without MAP_FIXED if START through START+SIZE are not currently
|
|
|
|
|
mapped with something. */
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
int
|
|
|
|
|
mmap_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
|
|
|
|
|
{
|
|
|
|
|
void *addr;
|
2003-01-10 03:22:34 +01:00
|
|
|
|
|
2004-03-11 04:19:04 +01:00
|
|
|
|
/* We're called with size == 0 if we're not planning to load a PCH
|
|
|
|
|
file at all. This allows the hook to free any static space that
|
|
|
|
|
we might have allocated at link time. */
|
|
|
|
|
if (size == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
|
|
|
|
|
fd, offset);
|
|
|
|
|
|
|
|
|
|
return addr == base ? 1 : -1;
|
1999-10-29 06:17:33 +02:00
|
|
|
|
}
|
2004-03-11 04:19:04 +01:00
|
|
|
|
#endif /* HAVE_MMAP_FILE */
|
2003-02-22 04:08:47 +01:00
|
|
|
|
|
2004-08-09 22:19:30 +02:00
|
|
|
|
/* Modify the bound based on rlimits. */
|
2003-02-23 17:56:04 +01:00
|
|
|
|
static double
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_rlimit_bound (double limit)
|
2003-02-23 17:56:04 +01:00
|
|
|
|
{
|
|
|
|
|
#if defined(HAVE_GETRLIMIT)
|
|
|
|
|
struct rlimit rlim;
|
2004-08-09 22:19:30 +02:00
|
|
|
|
# if defined (RLIMIT_AS)
|
|
|
|
|
/* RLIMIT_AS is what POSIX says is the limit on mmap. Presumably
|
|
|
|
|
any OS which has RLIMIT_AS also has a working mmap that GCC will use. */
|
|
|
|
|
if (getrlimit (RLIMIT_AS, &rlim) == 0
|
2003-03-03 00:48:24 +01:00
|
|
|
|
&& rlim.rlim_cur != (rlim_t) RLIM_INFINITY
|
2003-02-23 17:56:04 +01:00
|
|
|
|
&& rlim.rlim_cur < limit)
|
|
|
|
|
limit = rlim.rlim_cur;
|
2004-08-09 22:19:30 +02:00
|
|
|
|
# elif defined (RLIMIT_DATA)
|
|
|
|
|
/* ... but some older OSs bound mmap based on RLIMIT_DATA, or we
|
|
|
|
|
might be on an OS that has a broken mmap. (Others don't bound
|
|
|
|
|
mmap at all, apparently.) */
|
2003-02-23 17:56:04 +01:00
|
|
|
|
if (getrlimit (RLIMIT_DATA, &rlim) == 0
|
2003-03-03 00:48:24 +01:00
|
|
|
|
&& rlim.rlim_cur != (rlim_t) RLIM_INFINITY
|
2004-08-09 22:19:30 +02:00
|
|
|
|
&& rlim.rlim_cur < limit
|
|
|
|
|
/* Darwin has this horribly bogus default setting of
|
|
|
|
|
RLIMIT_DATA, to 6144Kb. No-one notices because RLIMIT_DATA
|
|
|
|
|
appears to be ignored. Ignore such silliness. If a limit
|
|
|
|
|
this small was actually effective for mmap, GCC wouldn't even
|
|
|
|
|
start up. */
|
|
|
|
|
&& rlim.rlim_cur >= 8 * 1024 * 1024)
|
2003-02-23 17:56:04 +01:00
|
|
|
|
limit = rlim.rlim_cur;
|
2004-08-09 22:19:30 +02:00
|
|
|
|
# endif /* RLIMIT_AS or RLIMIT_DATA */
|
2003-02-23 17:56:04 +01:00
|
|
|
|
#endif /* HAVE_GETRLIMIT */
|
|
|
|
|
|
|
|
|
|
return limit;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-22 04:08:47 +01:00
|
|
|
|
/* Heuristic to set a default for GGC_MIN_EXPAND. */
|
|
|
|
|
int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_min_expand_heuristic (void)
|
2003-02-22 04:08:47 +01:00
|
|
|
|
{
|
|
|
|
|
double min_expand = physmem_total();
|
2003-02-23 17:56:04 +01:00
|
|
|
|
|
|
|
|
|
/* Adjust for rlimits. */
|
|
|
|
|
min_expand = ggc_rlimit_bound (min_expand);
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-02-22 04:08:47 +01:00
|
|
|
|
/* The heuristic is a percentage equal to 30% + 70%*(RAM/1GB), yielding
|
|
|
|
|
a lower bound of 30% and an upper bound of 100% (when RAM >= 1GB). */
|
|
|
|
|
min_expand /= 1024*1024*1024;
|
|
|
|
|
min_expand *= 70;
|
|
|
|
|
min_expand = MIN (min_expand, 70);
|
|
|
|
|
min_expand += 30;
|
|
|
|
|
|
|
|
|
|
return min_expand;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Heuristic to set a default for GGC_MIN_HEAPSIZE. */
|
|
|
|
|
int
|
2003-06-07 20:35:35 +02:00
|
|
|
|
ggc_min_heapsize_heuristic (void)
|
2003-02-22 04:08:47 +01:00
|
|
|
|
{
|
2004-08-09 22:19:30 +02:00
|
|
|
|
double phys_kbytes = physmem_total();
|
|
|
|
|
double limit_kbytes = ggc_rlimit_bound (phys_kbytes * 2);
|
2003-02-23 17:56:04 +01:00
|
|
|
|
|
2004-08-09 22:19:30 +02:00
|
|
|
|
phys_kbytes /= 1024; /* Convert to Kbytes. */
|
|
|
|
|
limit_kbytes /= 1024;
|
2003-06-07 20:35:35 +02:00
|
|
|
|
|
2003-02-22 04:08:47 +01:00
|
|
|
|
/* The heuristic is RAM/8, with a lower bound of 4M and an upper
|
|
|
|
|
bound of 128M (when RAM >= 1GB). */
|
2004-08-09 22:19:30 +02:00
|
|
|
|
phys_kbytes /= 8;
|
|
|
|
|
|
|
|
|
|
#if defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS)
|
|
|
|
|
/* Try not to overrun the RSS limit while doing garbage collection.
|
|
|
|
|
The RSS limit is only advisory, so no margin is subtracted. */
|
|
|
|
|
{
|
|
|
|
|
struct rlimit rlim;
|
|
|
|
|
if (getrlimit (RLIMIT_RSS, &rlim) == 0
|
|
|
|
|
&& rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
|
|
|
|
|
phys_kbytes = MIN (phys_kbytes, rlim.rlim_cur / 1024);
|
|
|
|
|
}
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
/* Don't blindly run over our data limit; do GC at least when the
|
2006-10-26 22:39:10 +02:00
|
|
|
|
*next* GC would be within 20Mb of the limit or within a quarter of
|
|
|
|
|
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));
|
2004-08-09 22:19:30 +02:00
|
|
|
|
limit_kbytes = (limit_kbytes * 100) / (110 + ggc_min_expand_heuristic());
|
|
|
|
|
phys_kbytes = MIN (phys_kbytes, limit_kbytes);
|
|
|
|
|
|
|
|
|
|
phys_kbytes = MAX (phys_kbytes, 4 * 1024);
|
|
|
|
|
phys_kbytes = MIN (phys_kbytes, 128 * 1024);
|
2003-02-22 04:08:47 +01:00
|
|
|
|
|
2004-08-09 22:19:30 +02:00
|
|
|
|
return phys_kbytes;
|
2003-02-22 04:08:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-06-07 20:35:35 +02:00
|
|
|
|
init_ggc_heuristics (void)
|
2003-02-22 04:08:47 +01:00
|
|
|
|
{
|
2003-09-06 17:06:36 +02:00
|
|
|
|
#if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT
|
2003-02-22 04:08:47 +01:00
|
|
|
|
set_param_value ("ggc-min-expand", ggc_min_expand_heuristic());
|
|
|
|
|
set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic());
|
|
|
|
|
#endif
|
|
|
|
|
}
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
|
|
|
|
|
|
/* Datastructure used to store per-call-site statistics. */
|
|
|
|
|
struct loc_descriptor
|
|
|
|
|
{
|
|
|
|
|
const char *file;
|
|
|
|
|
int line;
|
|
|
|
|
const char *function;
|
|
|
|
|
int times;
|
|
|
|
|
size_t allocated;
|
|
|
|
|
size_t overhead;
|
2004-09-02 20:32:49 +02:00
|
|
|
|
size_t freed;
|
|
|
|
|
size_t collected;
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Hashtable used for statistics. */
|
|
|
|
|
static htab_t loc_hash;
|
|
|
|
|
|
|
|
|
|
/* Hash table helpers functions. */
|
|
|
|
|
static hashval_t
|
|
|
|
|
hash_descriptor (const void *p)
|
|
|
|
|
{
|
|
|
|
|
const struct loc_descriptor *d = p;
|
|
|
|
|
|
|
|
|
|
return htab_hash_pointer (d->function) | d->line;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
eq_descriptor (const void *p1, const void *p2)
|
|
|
|
|
{
|
|
|
|
|
const struct loc_descriptor *d = p1;
|
|
|
|
|
const struct loc_descriptor *d2 = p2;
|
|
|
|
|
|
|
|
|
|
return (d->file == d2->file && d->line == d2->line
|
|
|
|
|
&& d->function == d2->function);
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 20:32:49 +02:00
|
|
|
|
/* Hashtable converting address of allocated field to loc descriptor. */
|
|
|
|
|
static htab_t ptr_hash;
|
|
|
|
|
struct ptr_hash_entry
|
|
|
|
|
{
|
|
|
|
|
void *ptr;
|
|
|
|
|
struct loc_descriptor *loc;
|
|
|
|
|
size_t size;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Hash table helpers functions. */
|
|
|
|
|
static hashval_t
|
|
|
|
|
hash_ptr (const void *p)
|
|
|
|
|
{
|
|
|
|
|
const struct ptr_hash_entry *d = p;
|
|
|
|
|
|
|
|
|
|
return htab_hash_pointer (d->ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
eq_ptr (const void *p1, const void *p2)
|
|
|
|
|
{
|
|
|
|
|
const struct ptr_hash_entry *p = p1;
|
|
|
|
|
|
|
|
|
|
return (p->ptr == p2);
|
|
|
|
|
}
|
|
|
|
|
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
/* Return descriptor for given call site, create new one if needed. */
|
|
|
|
|
static struct loc_descriptor *
|
|
|
|
|
loc_descriptor (const char *name, int line, const char *function)
|
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor loc;
|
|
|
|
|
struct loc_descriptor **slot;
|
|
|
|
|
|
|
|
|
|
loc.file = name;
|
|
|
|
|
loc.line = line;
|
|
|
|
|
loc.function = function;
|
|
|
|
|
if (!loc_hash)
|
|
|
|
|
loc_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL);
|
|
|
|
|
|
|
|
|
|
slot = (struct loc_descriptor **) htab_find_slot (loc_hash, &loc, 1);
|
|
|
|
|
if (*slot)
|
|
|
|
|
return *slot;
|
|
|
|
|
*slot = xcalloc (sizeof (**slot), 1);
|
|
|
|
|
(*slot)->file = name;
|
|
|
|
|
(*slot)->line = line;
|
|
|
|
|
(*slot)->function = function;
|
|
|
|
|
return *slot;
|
|
|
|
|
}
|
|
|
|
|
|
c-common.c, [...]: Fix comment typos.
* c-common.c, cfgcleanup.c, cgraphunit.c, c-pretty-print.c,
expmed.c, ggc-common.c, jump.c, passes.c, recog.c, regmove.c,
reorg.c, tree.h: Fix comment typos.
From-SVN: r79730
2004-03-20 06:21:41 +01:00
|
|
|
|
/* Record ALLOCATED and OVERHEAD bytes to descriptor NAME:LINE (FUNCTION). */
|
|
|
|
|
void
|
2004-09-02 20:32:49 +02:00
|
|
|
|
ggc_record_overhead (size_t allocated, size_t overhead, void *ptr,
|
c-common.c, [...]: Fix comment typos.
* c-common.c, cfgcleanup.c, cgraphunit.c, c-pretty-print.c,
expmed.c, ggc-common.c, jump.c, passes.c, recog.c, regmove.c,
reorg.c, tree.h: Fix comment typos.
From-SVN: r79730
2004-03-20 06:21:41 +01:00
|
|
|
|
const char *name, int line, const char *function)
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor *loc = loc_descriptor (name, line, function);
|
2006-01-31 20:56:55 +01:00
|
|
|
|
struct ptr_hash_entry *p = XNEW (struct ptr_hash_entry);
|
2004-09-02 20:32:49 +02:00
|
|
|
|
PTR *slot;
|
|
|
|
|
|
|
|
|
|
p->ptr = ptr;
|
|
|
|
|
p->loc = loc;
|
|
|
|
|
p->size = allocated + overhead;
|
|
|
|
|
if (!ptr_hash)
|
|
|
|
|
ptr_hash = htab_create (10, hash_ptr, eq_ptr, NULL);
|
|
|
|
|
slot = htab_find_slot_with_hash (ptr_hash, ptr, htab_hash_pointer (ptr), INSERT);
|
gcse.c (INSN_CUID, [...]): Use gcc_assert and gcc_unreachable.
* gcse.c (INSN_CUID, insert_set_in_table, find_avail_set,
cprop_insn, do_local_cprop, local_cprop_pass, find_bypass_set,
process_insert_insn, insert_insn_end_bb, pre_insert_copy_insn,
hoist_code, extract_mentioned_regs_helper, compute_store_table,
insert_store): Use gcc_assert and gcc_unreachable.
* ggc-common.c (ggc_splay_alloc, ggc_splay_dont_free,
gt_pch_note_object, gt_pch_note_reorder, relocate_ptrs,
ggc_record_overhead): Likewise.
* ggc-page.c (alloc_page, free_page, ggc_set_mark, ggc_marked_p,
init_ggc, ggc_push_context, ggc_recalculate_in_use_p,
ggc_pop_context, clear_marks, validate_free_objects,
ggc_pch_read): Likewise.
* ggc-zone.c (ggc_allocated_p, free_chunk, ggc_set_mark,
ggc_marked_p, ggc_get_size, init_ggc, destroy_ggc_zone,
ggc_push_context, check_cookies, ggc_collect,
ggc_print_statistics): Likewise.
* gimple-low.c (lower_function_body, lower_stmt,
lower_bind_expr): Likewise.
* gimplify.c (gimple_tree_eq, push_gimplify_context,
pop_gimplify_context, gimple_pop_condition, create_tmp_var,
declare_tmp_vars, gimple_add_tmp_var, annotate_all_with_locus,
mostly_copy_tree_r, gimplify_return_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_block_expr,
canonicalize_component_ref, gimplify_compound_lval,
gimplify_self_mod_expr, gimplify_call_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_modify_expr, gimplify_save_expr, gimplify_target_expr,
gimplify_expr, check_pointer_types_r,
force_gimple_operand): Likewise.
* global.c (global_alloc, build_insn_chain): Likewise.
* graph.c (clean_graph_dump_file,
finish_graph_dump_file): Likewise.
gcov-io.c (gcov_open): Use GCOV_CHECK.
From-SVN: r87240
2004-09-09 15:54:07 +02:00
|
|
|
|
gcc_assert (!*slot);
|
2004-09-02 20:32:49 +02:00
|
|
|
|
*slot = p;
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
|
|
|
|
|
loc->times++;
|
|
|
|
|
loc->allocated+=allocated;
|
|
|
|
|
loc->overhead+=overhead;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-02 20:32:49 +02:00
|
|
|
|
/* Helper function for prune_overhead_list. See if SLOT is still marked and
|
|
|
|
|
remove it from hashtable if it is not. */
|
|
|
|
|
static int
|
|
|
|
|
ggc_prune_ptr (void **slot, void *b ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
struct ptr_hash_entry *p = *slot;
|
|
|
|
|
if (!ggc_marked_p (p->ptr))
|
|
|
|
|
{
|
|
|
|
|
p->loc->collected += p->size;
|
|
|
|
|
htab_clear_slot (ptr_hash, slot);
|
|
|
|
|
free (p);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* After live values has been marked, walk all recorded pointers and see if
|
|
|
|
|
they are still live. */
|
|
|
|
|
void
|
|
|
|
|
ggc_prune_overhead_list (void)
|
|
|
|
|
{
|
|
|
|
|
htab_traverse (ptr_hash, ggc_prune_ptr, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Notice that the pointer has been freed. */
|
2006-07-07 16:23:57 +02:00
|
|
|
|
void
|
|
|
|
|
ggc_free_overhead (void *ptr)
|
2004-09-02 20:32:49 +02:00
|
|
|
|
{
|
|
|
|
|
PTR *slot = htab_find_slot_with_hash (ptr_hash, ptr, htab_hash_pointer (ptr),
|
|
|
|
|
NO_INSERT);
|
|
|
|
|
struct ptr_hash_entry *p = *slot;
|
|
|
|
|
p->loc->freed += p->size;
|
|
|
|
|
htab_clear_slot (ptr_hash, slot);
|
|
|
|
|
free (p);
|
|
|
|
|
}
|
|
|
|
|
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
/* Helper for qsort; sort descriptors by amount of memory consumed. */
|
|
|
|
|
static int
|
2006-12-23 15:30:36 +01:00
|
|
|
|
final_cmp_statistic (const void *loc1, const void *loc2)
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor *l1 = *(struct loc_descriptor **) loc1;
|
|
|
|
|
struct loc_descriptor *l2 = *(struct loc_descriptor **) loc2;
|
2006-12-23 15:30:36 +01:00
|
|
|
|
long diff;
|
|
|
|
|
diff = ((long)(l1->allocated + l1->overhead - l1->freed) -
|
2004-09-12 22:14:23 +02:00
|
|
|
|
(l2->allocated + l2->overhead - l2->freed));
|
2006-12-23 15:30:36 +01:00
|
|
|
|
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Helper for qsort; sort descriptors by amount of memory consumed. */
|
|
|
|
|
static int
|
|
|
|
|
cmp_statistic (const void *loc1, const void *loc2)
|
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor *l1 = *(struct loc_descriptor **) loc1;
|
|
|
|
|
struct loc_descriptor *l2 = *(struct loc_descriptor **) loc2;
|
|
|
|
|
long diff;
|
|
|
|
|
|
|
|
|
|
diff = ((long)(l1->allocated + l1->overhead - l1->freed - l1->collected) -
|
|
|
|
|
(l2->allocated + l2->overhead - l2->freed - l2->collected));
|
|
|
|
|
if (diff)
|
|
|
|
|
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
|
|
|
|
|
diff = ((long)(l1->allocated + l1->overhead - l1->freed) -
|
|
|
|
|
(l2->allocated + l2->overhead - l2->freed));
|
|
|
|
|
return diff > 0 ? 1 : diff < 0 ? -1 : 0;
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Collect array of the descriptors from hashtable. */
|
|
|
|
|
struct loc_descriptor **loc_array;
|
|
|
|
|
static int
|
|
|
|
|
add_statistics (void **slot, void *b)
|
|
|
|
|
{
|
|
|
|
|
int *n = (int *)b;
|
|
|
|
|
loc_array[*n] = (struct loc_descriptor *) *slot;
|
|
|
|
|
(*n)++;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dump per-site memory statistics. */
|
|
|
|
|
#endif
|
2006-07-07 16:23:57 +02:00
|
|
|
|
void
|
2006-12-23 15:30:36 +01:00
|
|
|
|
dump_ggc_loc_statistics (bool final ATTRIBUTE_UNUSED)
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
{
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
|
int nentries = 0;
|
|
|
|
|
char s[4096];
|
2004-09-02 20:32:49 +02:00
|
|
|
|
size_t collected = 0, freed = 0, allocated = 0, overhead = 0, times = 0;
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
int i;
|
|
|
|
|
|
2004-09-02 20:32:49 +02:00
|
|
|
|
ggc_force_collect = true;
|
|
|
|
|
ggc_collect ();
|
|
|
|
|
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
loc_array = xcalloc (sizeof (*loc_array), loc_hash->n_elements);
|
|
|
|
|
fprintf (stderr, "-------------------------------------------------------\n");
|
2004-09-02 20:32:49 +02:00
|
|
|
|
fprintf (stderr, "\n%-48s %10s %10s %10s %10s %10s\n",
|
|
|
|
|
"source location", "Garbage", "Freed", "Leak", "Overhead", "Times");
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
fprintf (stderr, "-------------------------------------------------------\n");
|
|
|
|
|
htab_traverse (loc_hash, add_statistics, &nentries);
|
2006-12-23 15:30:36 +01:00
|
|
|
|
qsort (loc_array, nentries, sizeof (*loc_array),
|
|
|
|
|
final ? final_cmp_statistic : cmp_statistic);
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
for (i = 0; i < nentries; i++)
|
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor *d = loc_array[i];
|
2004-09-02 20:32:49 +02:00
|
|
|
|
allocated += d->allocated;
|
|
|
|
|
times += d->times;
|
|
|
|
|
freed += d->freed;
|
|
|
|
|
collected += d->collected;
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
overhead += d->overhead;
|
|
|
|
|
}
|
|
|
|
|
for (i = 0; i < nentries; i++)
|
|
|
|
|
{
|
|
|
|
|
struct loc_descriptor *d = loc_array[i];
|
|
|
|
|
if (d->allocated)
|
|
|
|
|
{
|
|
|
|
|
const char *s1 = d->file;
|
|
|
|
|
const char *s2;
|
|
|
|
|
while ((s2 = strstr (s1, "gcc/")))
|
|
|
|
|
s1 = s2 + 4;
|
|
|
|
|
sprintf (s, "%s:%i (%s)", s1, d->line, d->function);
|
2004-09-02 20:32:49 +02:00
|
|
|
|
s[48] = 0;
|
|
|
|
|
fprintf (stderr, "%-48s %10li:%4.1f%% %10li:%4.1f%% %10li:%4.1f%% %10li:%4.1f%% %10li\n", s,
|
|
|
|
|
(long)d->collected,
|
|
|
|
|
(d->collected) * 100.0 / collected,
|
|
|
|
|
(long)d->freed,
|
|
|
|
|
(d->freed) * 100.0 / freed,
|
|
|
|
|
(long)(d->allocated + d->overhead - d->freed - d->collected),
|
|
|
|
|
(d->allocated + d->overhead - d->freed - d->collected) * 100.0
|
|
|
|
|
/ (allocated + overhead - freed - collected),
|
|
|
|
|
(long)d->overhead,
|
|
|
|
|
d->overhead * 100.0 / overhead,
|
|
|
|
|
(long)d->times);
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-09-02 20:32:49 +02:00
|
|
|
|
fprintf (stderr, "%-48s %10ld %10ld %10ld %10ld %10ld\n",
|
|
|
|
|
"Total", (long)collected, (long)freed,
|
|
|
|
|
(long)(allocated + overhead - freed - collected), (long)overhead,
|
|
|
|
|
(long)times);
|
|
|
|
|
fprintf (stderr, "%-48s %10s %10s %10s %10s %10s\n",
|
|
|
|
|
"source location", "Garbage", "Freed", "Leak", "Overhead", "Times");
|
ggc-common.c (ggc_alloc_cleared_stat, [...]): Rename from ...; make statistics transparent.
* ggc-common.c (ggc_alloc_cleared_stat, ggc_realloc_stat):
Rename from ...; make statistics transparent.
(ggc_alloc_cleared, ggc_realloc_stat): ... these.
(loc_descriptor): New structure.
(hash_descriptor, eq_descriptor, loc_descriptor, cmp_statistics,
add_statistics):
New static function.
(ggc_record_overhead, dump_statistics): New global function.
* ggc-none.c (ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Rename
from ...; accept locations
(ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): ... this one.
from ...; accept locations
* ggc-page.c (ggc_alloc_typed_stat, ggc_alloc_zone_stat,
ggc_alloc_stat): Rename from ... ; pass locations
* ggc-page.c (ggc_alloc_typed, ggc_alloc_zone, ggc_alloc):
... this one.
(ggc_alloc_stat): Record overehead.
* ggc.h (ggc_alloc_types, ggc_alloc, ggc_alloc_zone, ggc_alloc_cleared,
ggc_realloc, ggc_alloc_typed): Turn to macros
(ggc_alloc_types_stat, ggc_alloc_stat, ggc_alloc_zone_stat,
ggc_alloc_cleared_stat, ggc_realloc_stat, ggc_alloc_typed_stat): Declare.
(dump_ggc_loc_satistics, ggc_record_overehead): Declare.
* langhooks.h (lhd_make_node): Declare.
(LANG_HOOKS_MAKE_TYPE): Default to new function,
* langhooks.c (lhd_make_node): New.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Rename from ... ; pass
locations.
(rtx_alloc, swallow_copy_rtx): ... this one.
* rtl.h (rtx_alloc, swallow_copy_rtx): Turn to macros.
* rtl.c (rtx_alloc_stat, swallow_copy_rtx_stat): Declare.
* toplpev.c (finalize): Dump stats.
* tree.c (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Rename from ... ; pass locators.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): Declare.
* tree.h (make_node_stat, copy_node_stat, make_tree_vec_stat,
build_tree_list_stat, tree_cons_stat, build?_stat, build_decl_stat):
Declare.
(make_node, copy_node, make_tree_vec, build_tree_list, tree_cons,
build?, build_decl): New macros.
* Makefile.in (RTL_H, TREE_H): Add statistics.h dependency.
* statistics.h: New file.
From-SVN: r78826
2004-03-03 12:25:51 +01:00
|
|
|
|
fprintf (stderr, "-------------------------------------------------------\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|