Commit c9ef0409 by Jan Hubicka Committed by Jan Hubicka

config.in: Regenerate.

 	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for mallinfo.
	* ggc-common.c: Include malloc.h if available;
	include options.h
	(report_heap_memory_use): New functoin.
	* ggc-page.c (ggc_grow): Do not print "start".
	* ggc.h (report_heap_memory_use): Declare.
	* pases.c (execute_one_pass): Report memory after IPA passes.
	(ipa_read_summaries_1): Likewise.
	(ipa_read_optimization_summaries_1): Likewise.

	* lto/lto-common.c (read_cgraph_and_symbols): Improve -Q reporting.
	* lto.c (lto_wpa_write_files): Likewise.

From-SVN: r277753
parent da5c1bbe
......@@ -958,6 +958,13 @@
#endif
/* Define to 1 if we found a declaration for 'mallinfo', otherwise define to
0. */
#ifndef USED_FOR_TARGET
#undef HAVE_DECL_MALLINFO
#endif
/* Define to 1 if we found a declaration for 'malloc', otherwise define to 0.
*/
#ifndef USED_FOR_TARGET
......@@ -1627,6 +1634,12 @@
#endif
/* Define to 1 if you have the `mallinfo' function. */
#ifndef USED_FOR_TARGET
#undef HAVE_MALLINFO
#endif
/* Define to 1 if you have the <malloc.h> header file. */
#ifndef USED_FOR_TARGET
#undef HAVE_MALLOC_H
......
......@@ -903,6 +903,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
......@@ -1067,6 +1068,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
......@@ -1319,6 +1321,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
......@@ -1456,7 +1467,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
......@@ -1609,6 +1620,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
......@@ -5893,7 +5905,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
......@@ -5939,7 +5951,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
......@@ -5963,7 +5975,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
......@@ -6008,7 +6020,7 @@ else
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
......@@ -6032,7 +6044,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
......@@ -10051,7 +10063,7 @@ LIBS="$save_LIBS"
for ac_func in times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap setlocale \
clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise
clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
......@@ -11465,6 +11477,61 @@ fi
done
for ac_func in mallinfo
do
ac_tr_decl=`$as_echo "HAVE_DECL_$ac_func" | $as_tr_cpp`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_func is declared" >&5
$as_echo_n "checking whether $ac_func is declared... " >&6; }
if eval \${gcc_cv_have_decl_$ac_func+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#undef $ac_tr_decl
#define $ac_tr_decl 1
#include "ansidecl.h"
#include "system.h"
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
int
main ()
{
#ifndef $ac_func
char *(*pfn) = (char *(*)) $ac_func ;
#endif
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
eval "gcc_cv_have_decl_$ac_func=yes"
else
eval "gcc_cv_have_decl_$ac_func=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if eval "test \"`echo '$gcc_cv_have_decl_'$ac_func`\" = yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } ; cat >>confdefs.h <<_ACEOF
#define $ac_tr_decl 1
_ACEOF
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } ; cat >>confdefs.h <<_ACEOF
#define $ac_tr_decl 0
_ACEOF
fi
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
......@@ -18868,7 +18935,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 18871 "configure"
#line 18938 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -18974,7 +19041,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 18977 "configure"
#line 19044 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......
......@@ -1374,7 +1374,7 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap setlocale \
gcc_UNLOCKED_FUNCS madvise)
gcc_UNLOCKED_FUNCS madvise mallinfo)
if test x$ac_cv_func_mbstowcs = xyes; then
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
......@@ -1454,6 +1454,14 @@ gcc_AC_CHECK_DECLS(getrlimit setrlimit getrusage, , ,[
#endif
])
gcc_AC_CHECK_DECLS(mallinfo, , ,[
#include "ansidecl.h"
#include "system.h"
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "ansidecl.h"
#include "system.h"
......
......@@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see
any particular GC implementation. */
#include "config.h"
#ifdef HAVE_MALLINFO
#include <malloc.h>
#endif
#include "system.h"
#include "coretypes.h"
#include "timevar.h"
......@@ -29,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "hosthooks.h"
#include "plugin.h"
#include "options.h"
/* When set, ggc_collect will do collection. */
bool ggc_force_collect;
......@@ -1006,3 +1010,14 @@ ggc_prune_overhead_list (void)
delete ggc_mem_desc.m_reverse_object_map;
ggc_mem_desc.m_reverse_object_map = new map_t (13, false, false, false);
}
/* Return memory used by heap in kb, 0 if this info is not available. */
void
report_heap_memory_use ()
{
#ifdef HAVE_MALLINFO
if (!quiet_flag)
fprintf (stderr," {heap %luk}", (unsigned long)(mallinfo().arena / 1024));
#endif
}
......@@ -2267,7 +2267,7 @@ ggc_grow (void)
else
ggc_collect ();
if (!quiet_flag)
fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / 1024);
fprintf (stderr, " {GC %luk} ", (unsigned long) G.allocated / 1024);
}
void
......
......@@ -278,6 +278,9 @@ extern void stringpool_statistics (void);
/* Heuristics. */
extern void init_ggc_heuristics (void);
/* Report current heap memory use to stderr. */
extern void report_heap_memory_use (void);
#define ggc_alloc_rtvec_sized(NELT) \
(rtvec_def *) ggc_internal_alloc (sizeof (struct rtvec_def) \
+ ((NELT) - 1) * sizeof (rtx)) \
......
2019-11-02 Jan Hubicka <hubicka@ucw.cz>
* lto-common.c (read_cgraph_and_symbols): Improve -Q reporting.
* lto.c (lto_wpa_write_files): Likewise.
2019-10-31 Jakub Jelinek <jakub@redhat.com>
PR middle-end/92231
......
......@@ -2784,6 +2784,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* At this stage we know that majority of GGC memory is reachable.
Growing the limits prevents unnecesary invocation of GGC. */
ggc_grow ();
report_heap_memory_use ();
/* Set the hooks so that all of the ipa passes can read in their data. */
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
......@@ -2791,7 +2792,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_pop (TV_IPA_LTO_DECL_IN);
if (!quiet_flag)
fprintf (stderr, "\nReading the callgraph\n");
fprintf (stderr, "\nReading the symbol table:");
timevar_push (TV_IPA_LTO_CGRAPH_IO);
/* Read the symtab. */
......@@ -2831,7 +2832,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_pop (TV_IPA_LTO_CGRAPH_IO);
if (!quiet_flag)
fprintf (stderr, "Merging declarations\n");
fprintf (stderr, "\nMerging declarations:");
timevar_push (TV_IPA_LTO_DECL_MERGE);
/* Merge global decls. In ltrans mode we read merged cgraph, we do not
......@@ -2859,12 +2860,13 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
is explcitly managed by ggc_free and ggc collect is not useful.
Exception are the merged declarations. */
ggc_grow ();
report_heap_memory_use ();
timevar_pop (TV_IPA_LTO_DECL_MERGE);
/* Each pass will set the appropriate timer. */
if (!quiet_flag)
fprintf (stderr, "Reading summaries\n");
fprintf (stderr, "\nReading summaries:");
/* Read the IPA summary data. */
if (flag_ltrans)
......@@ -2891,6 +2893,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
/* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
if (!quiet_flag)
fprintf (stderr, "\nMerging symbols:");
gcc_assert (!dump_file);
dump_file = dump_begin (lto_link_dump_id, NULL);
......@@ -2905,6 +2910,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
We could also just remove them while merging. */
symtab->remove_unreachable_nodes (dump_file);
ggc_collect ();
report_heap_memory_use ();
if (dump_file)
dump_end (lto_link_dump_id, dump_file);
......
......@@ -312,6 +312,8 @@ lto_wpa_write_files (void)
lto_prepare_function_for_streaming (node);
ggc_trim ();
report_heap_memory_use ();
/* Generate a prefix for the LTRANS unit files. */
blen = strlen (ltrans_output_list);
temp_filename = (char *) xmalloc (blen + sizeof ("2147483648.o"));
......
......@@ -2564,6 +2564,8 @@ execute_one_pass (opt_pass *pass)
if (!((todo_after | pass->todo_flags_finish) & TODO_do_not_ggc_collect))
ggc_collect ();
if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
report_heap_memory_use ();
return true;
}
......@@ -2818,6 +2820,8 @@ ipa_read_summaries_1 (opt_pass *pass)
/* If a timevar is present, start it. */
if (pass->tv_id)
timevar_push (pass->tv_id);
if (!quiet_flag)
fprintf (stderr, " <%s>", pass->name ? pass->name : "");
pass_init_dump_file (pass);
......@@ -2829,6 +2833,8 @@ ipa_read_summaries_1 (opt_pass *pass)
/* Stop timevar. */
if (pass->tv_id)
timevar_pop (pass->tv_id);
ggc_grow ();
report_heap_memory_use ();
}
if (pass->sub && pass->sub->type != GIMPLE_PASS)
......@@ -2869,6 +2875,8 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
/* If a timevar is present, start it. */
if (pass->tv_id)
timevar_push (pass->tv_id);
if (!quiet_flag)
fprintf (stderr, " <%s>", pass->name ? pass->name : "");
pass_init_dump_file (pass);
......@@ -2884,6 +2892,8 @@ ipa_read_optimization_summaries_1 (opt_pass *pass)
if (pass->sub && pass->sub->type != GIMPLE_PASS)
ipa_read_optimization_summaries_1 (pass->sub);
ggc_grow ();
report_heap_memory_use ();
}
pass = pass->next;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment