aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-05-25 04:58:54 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-05-25 02:58:54 +0000
commitfd1e93027047ca891e278fac96d38978aeb51d6d (patch)
tree41a5b3a40274b4ea228e9edf919dd2dfac1e4e80 /gcc
parent7f7beb3f103ec602dc863ba9473bdff4337d5fff (diff)
downloadgcc-fd1e93027047ca891e278fac96d38978aeb51d6d.zip
gcc-fd1e93027047ca891e278fac96d38978aeb51d6d.tar.gz
gcc-fd1e93027047ca891e278fac96d38978aeb51d6d.tar.bz2
ggc.h (ggc_grow): New function.
* ggc.h (ggc_grow): New function. * ggc-none.c (ggc_grow): New function. * ggc-page.c (ggc_grow): Likewise. * lto.c (read_cgraph_and_symbols): Grow ggc memory after streaming. From-SVN: r210908
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ggc-none.c5
-rw-r--r--gcc/ggc-page.c17
-rw-r--r--gcc/ggc.h3
-rw-r--r--gcc/lto/ChangeLog4
-rw-r--r--gcc/lto/lto.c4
6 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 05f5e3e..46aa41c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2014-05-23 Jan Hubicka <hubicka@ucw.cz>
+ * ggc.h (ggc_grow): New function.
+ * ggc-none.c (ggc_grow): New function.
+ * ggc-page.c (ggc_grow): Likewise.
+
+2014-05-23 Jan Hubicka <hubicka@ucw.cz>
+
* ipa.c (cgraph_non_local_node_p_1, cgraph_local_node_p, address_taken_from_non_vtable_p,
comdat_can_be_unshared_p_1, comdat_can_be_unshared_p, cgraph_externally_visible_p,
varpool_externally_visible_p, can_replace_by_local_alias,
diff --git a/gcc/ggc-none.c b/gcc/ggc-none.c
index 97d3566..29a7b2f 100644
--- a/gcc/ggc-none.c
+++ b/gcc/ggc-none.c
@@ -67,3 +67,8 @@ ggc_free (void *p)
{
free (p);
}
+
+void
+ggc_grow (void)
+{
+}
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index a8d8d0e..e37ddc2 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -2185,6 +2185,23 @@ ggc_collect (void)
fprintf (G.debug_file, "END COLLECTING\n");
}
+/* Assume that all GGC memory is reachable and grow the limits for next collection.
+ With checking, trigger GGC so -Q compilation outputs how much of memory really is
+ reachable. */
+
+void
+ggc_grow (void)
+{
+#ifndef ENABLE_CHECKING
+ G.allocated_last_gc = MAX (G.allocated_last_gc,
+ G.allocated);
+#else
+ ggc_collect ();
+#endif
+ if (!quiet_flag)
+ fprintf (stderr, " {GC start %luk} ", (unsigned long) G.allocated / 1024);
+}
+
/* Print allocation statistics. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 1279aee..1c0fd3d 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -282,6 +282,9 @@ extern const char *ggc_alloc_string (const char *contents, int length
function is called, not during allocations. */
extern void ggc_collect (void);
+/* Assume that all GGC memory is reachable and grow the limits for next collection. */
+extern void ggc_grow (void);
+
/* Register an additional root table. This can be useful for some
plugins. Does nothing if the passed pointer is NULL. */
extern void ggc_register_root_tab (const struct ggc_root_tab *);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index f4a226b..8fd483e 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,5 +1,9 @@
2014-05-23 Jan Hubicka <hubicka@ucw.cz>
+ * lto.c (read_cgraph_and_symbols): Grow ggc memory after streaming.
+
+2014-05-23 Jan Hubicka <hubicka@ucw.cz>
+
* lto-symtab.c (lto_symtab_merge_symbols): Update code setting
symtab pointer.
* lto.c (compare_tree_sccs_1): Do not compare comdat groups.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index e5cdfc1..41d63f6 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -3001,6 +3001,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
gimple_canonical_types = NULL;
delete canonical_type_hash_cache;
canonical_type_hash_cache = NULL;
+
+ /* At this stage we know that majority of GGC memory is reachable.
+ Growing the limits prevents unnecesary invocation of GGC. */
+ ggc_grow ();
ggc_collect ();
/* Set the hooks so that all of the ipa passes can read in their data. */