[llvm-commits] [llvm-gcc-4.2] r58571 - in /llvm-gcc-4.2/trunk: gcc/ggc-common.c gcc/ggc.h gcc/toplev.c include/libiberty.h libiberty/physmem.c
Bill Wendling
isanbard at gmail.com
Sun Nov 2 17:24:46 PST 2008
Author: void
Date: Sun Nov 2 19:24:44 2008
New Revision: 58571
URL: http://llvm.org/viewvc/llvm-project?rev=58571&view=rev
Log:
Retune the GC parameters. Do not issue any deprecated warning in a function that itself is deprecated.
Modified:
llvm-gcc-4.2/trunk/gcc/ggc-common.c
llvm-gcc-4.2/trunk/gcc/ggc.h
llvm-gcc-4.2/trunk/gcc/toplev.c
llvm-gcc-4.2/trunk/include/libiberty.h
llvm-gcc-4.2/trunk/libiberty/physmem.c
Modified: llvm-gcc-4.2/trunk/gcc/ggc-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ggc-common.c?rev=58571&r1=58570&r2=58571&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ggc-common.c (original)
+++ llvm-gcc-4.2/trunk/gcc/ggc-common.c Sun Nov 2 19:24:44 2008
@@ -716,10 +716,12 @@
min_expand = ggc_rlimit_bound (min_expand);
/* 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). */
+ APPLE LOCAL retune gc params 6124839
+ a lower bound of 30% and an upper bound of 150% (when RAM >= 1.7GB). */
min_expand /= 1024*1024*1024;
min_expand *= 70;
- min_expand = MIN (min_expand, 70);
+ /* APPLE LOCAL retune gc params 6124839 */
+ min_expand = MIN (min_expand, 120);
min_expand += 30;
return min_expand;
@@ -727,7 +729,8 @@
/* Heuristic to set a default for GGC_MIN_HEAPSIZE. */
int
-ggc_min_heapsize_heuristic (void)
+/* APPLE LOCAL retune gc params 6124839 */
+ggc_min_heapsize_heuristic (bool optimize)
{
double phys_kbytes = physmem_total();
double limit_kbytes = ggc_rlimit_bound (phys_kbytes * 2);
@@ -739,6 +742,13 @@
bound of 128M (when RAM >= 1GB). */
phys_kbytes /= 8;
+ /* APPLE LOCAL begin retune gc params 6124839 */
+
+ /* Additionally, on a multicore machine, we assume that we share the
+ memory with others reasonably equally. */
+ phys_kbytes /= (double)ncpu_available() / (2 - optimize);
+ /* APPLE LOCAL end retune gc params 6124839 */
+
#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. */
@@ -765,11 +775,13 @@
}
void
-init_ggc_heuristics (void)
+/* APPLE LOCAL retune gc params 6124839 */
+init_ggc_heuristics (bool optimize ATTRIBUTE_UNUSED)
{
#if !defined ENABLE_GC_CHECKING && !defined ENABLE_GC_ALWAYS_COLLECT
set_param_value ("ggc-min-expand", ggc_min_expand_heuristic());
- set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic());
+ /* APPLE LOCAL retune gc params 6124839 */
+ set_param_value ("ggc-min-heapsize", ggc_min_heapsize_heuristic(optimize));
#endif
}
Modified: llvm-gcc-4.2/trunk/gcc/ggc.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ggc.h?rev=58571&r1=58570&r2=58571&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ggc.h (original)
+++ llvm-gcc-4.2/trunk/gcc/ggc.h Sun Nov 2 19:24:44 2008
@@ -290,8 +290,10 @@
/* Heuristics. */
extern int ggc_min_expand_heuristic (void);
-extern int ggc_min_heapsize_heuristic (void);
-extern void init_ggc_heuristics (void);
+/* APPLE LOCAL begin retune gc params 6124839 */
+extern int ggc_min_heapsize_heuristic (bool);
+extern void init_ggc_heuristics (bool);
+/* APPLE LOCAL end retune gc params 6124839 */
/* Zone collection. */
#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
Modified: llvm-gcc-4.2/trunk/gcc/toplev.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/toplev.c?rev=58571&r1=58570&r2=58571&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/toplev.c (original)
+++ llvm-gcc-4.2/trunk/gcc/toplev.c Sun Nov 2 19:24:44 2008
@@ -938,6 +938,11 @@
if (node == 0 || !warn_deprecated_decl)
return;
+ /* APPLE LOCAL begin radar 4746503 */
+ if (current_function_decl && TREE_DEPRECATED (current_function_decl))
+ return;
+ /* APPLE LOCAL end radar 4746503 */
+
if (DECL_P (node))
{
expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
@@ -1713,8 +1718,19 @@
/* Register the language-independent parameters. */
add_params (lang_independent_params, LAST_PARAM);
- /* This must be done after add_params but before argument processing. */
- init_ggc_heuristics();
+ /* APPLE LOCAL begin retune gc params 6124839 */
+ { int i = 0;
+ bool opt = false;
+ while (save_argv[++i])
+ {
+ if (strncmp (save_argv[i], "-O", 2) == 0
+ && strcmp (save_argv[i], "-O0") != 0)
+ opt = true;
+ }
+ /* This must be done after add_params but before argument processing. */
+ init_ggc_heuristics(opt);
+ }
+ /* APPLE LOCAL end retune gc params 6124839 */
init_optimization_passes ();
}
Modified: llvm-gcc-4.2/trunk/include/libiberty.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/include/libiberty.h?rev=58571&r1=58570&r2=58571&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/include/libiberty.h (original)
+++ llvm-gcc-4.2/trunk/include/libiberty.h Sun Nov 2 19:24:44 2008
@@ -296,6 +296,10 @@
extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC;
+/* APPLE LOCAL begin retune gc params 6124839 */
+extern unsigned int ncpu_available (void);
+/* APPLE LOCAL end retune gc params 6124839 */
+
/* Physical memory routines. Return values are in BYTES. */
extern double physmem_total (void);
extern double physmem_available (void);
Modified: llvm-gcc-4.2/trunk/libiberty/physmem.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libiberty/physmem.c?rev=58571&r1=58570&r2=58571&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libiberty/physmem.c (original)
+++ llvm-gcc-4.2/trunk/libiberty/physmem.c Sun Nov 2 19:24:44 2008
@@ -182,6 +182,36 @@
return 0;
}
+/* APPLE LOCAL begin retune gc params 6124839 */
+unsigned int
+ncpu_available (void)
+{
+#if HAVE_SYSCTL && defined HW_AVAILCPU
+ { /* This works on *bsd and darwin. */
+ unsigned int ncpu;
+ size_t len = sizeof ncpu;
+ static int mib[2] = { CTL_HW, HW_AVAILCPU };
+
+ if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0
+ && len == sizeof (ncpu))
+ return ncpu;
+ }
+#endif
+#if HAVE_SYSCTL && defined HW_NCPU
+ { /* This works on *bsd and darwin. */
+ unsigned int ncpu;
+ size_t len = sizeof ncpu;
+ static int mib[2] = { CTL_HW, HW_NCPU };
+
+ if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0
+ && len == sizeof (ncpu))
+ return ncpu;
+ }
+#endif
+ return 1;
+}
+/* APPLE LOCAL end retune gc params 6124839 */
+
/* Return the amount of physical memory available. */
double
physmem_available (void)
More information about the llvm-commits
mailing list