aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/misc.c
diff options
context:
space:
mode:
authorHans Boehm <Hans_Boehm@hp.com>2001-04-05 00:14:18 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-04-05 00:14:18 +0000
commit41029b884ae16a2fc2b36cedfd20d7a1e68cfdb6 (patch)
tree88a556f74fb0052ef40f7b32c7dc19756675fe56 /boehm-gc/misc.c
parent48f9396dd6166819d204e931b4d2d9d2da704a73 (diff)
downloadgcc-41029b884ae16a2fc2b36cedfd20d7a1e68cfdb6.zip
gcc-41029b884ae16a2fc2b36cedfd20d7a1e68cfdb6.tar.gz
gcc-41029b884ae16a2fc2b36cedfd20d7a1e68cfdb6.tar.bz2
finalize.c: - Accomodate finalization requests for static objects.
2001-04-04 Hans Boehm <hans_boehm@hp.com> * finalize.c: - Accomodate finalization requests for static objects. (Will be required by hash synchronization. May be needed in some configurations now.) * gc_priv.h: - Define MIN_WORDS. All allocation requests are rounded up to at least this size. Removes a subtle assumption that Java objects have a 2 word header. * gcconfig.h: - Adjust Linux/IA64 configuration for non-ancient kernels. (Necessary fix for IA64.) * linux_threads.c: - Fix syntax error in currently unused code. Will be needed for Linux/PA-RISC. * malloc.c: - Handle MIN_WORDS. * misc.c: - Handle MIN_WORDS. - Change stack cleaning code to typically clear about one tenth the memory it used to in the threads configuration. Occasionally still clear more. (This is really a fix for a long-standing and fairly significant performance bug with threads.) * os_dep.c: - Fix the code for finding the beginning of the data segment under Linux. I believe this is necessary for some IA64 Linux distributions. It will also helo other platforms, though those may additionally require a gcconfig.h adjustment. (This basically works around the absence of a data_start or __data_start definition in glibc.) * test.c: - Handle rounding due to MIN_WORDS. From-SVN: r41102
Diffstat (limited to 'boehm-gc/misc.c')
-rw-r--r--boehm-gc/misc.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/boehm-gc/misc.c b/boehm-gc/misc.c
index dd42961..1e1ada5 100644
--- a/boehm-gc/misc.c
+++ b/boehm-gc/misc.c
@@ -107,13 +107,17 @@ extern signed_word GC_mem_found;
{
register unsigned i;
- /* Map size 0 to 1. This avoids problems at lower levels. */
- GC_size_map[0] = 1;
+ /* Map size 0 to something bigger. */
+ /* This avoids problems at lower levels. */
/* One word objects don't have to be 2 word aligned. */
- for (i = 1; i < sizeof(word); i++) {
- GC_size_map[i] = 1;
+ for (i = 0; i < sizeof(word); i++) {
+ GC_size_map[i] = MIN_WORDS;
}
- GC_size_map[sizeof(word)] = ROUNDED_UP_WORDS(sizeof(word));
+# if MIN_WORDS > 1
+ GC_size_map[sizeof(word)] = MIN_WORDS;
+# else
+ GC_size_map[sizeof(word)] = ROUNDED_UP_WORDS(sizeof(word));
+# endif
for (i = sizeof(word) + 1; i <= 8 * sizeof(word); i++) {
# ifdef ALIGN_DOUBLE
GC_size_map[i] = (ROUNDED_UP_WORDS(i) + 1) & (~1);
@@ -202,10 +206,10 @@ extern signed_word GC_mem_found;
*/
word GC_stack_last_cleared = 0; /* GC_no when we last did this */
# ifdef THREADS
-# define CLEAR_SIZE 2048
-# else
-# define CLEAR_SIZE 213
+# define BIG_CLEAR_SIZE 2048 /* Clear this much now and then. */
+# define SMALL_CLEAR_SIZE 256 /* Clear this much every time. */
# endif
+# define CLEAR_SIZE 213 /* Granularity for GC_clear_stack_inner */
# define DEGRADE_RATE 50
word GC_min_sp; /* Coolest stack pointer value from which we've */
@@ -262,10 +266,12 @@ ptr_t arg;
{
register word sp = (word)GC_approx_sp(); /* Hotter than actual sp */
# ifdef THREADS
- word dummy[CLEAR_SIZE];
-# else
- register word limit;
+ word dummy[SMALL_CLEAR_SIZE];
+ unsigned random_no = 0; /* Should be more random than it is ... */
+ /* Used to occasionally clear a bigger */
+ /* chunk. */
# endif
+ register word limit;
# define SLOP 400
/* Extra bytes we clear every time. This clears our own */
@@ -283,7 +289,14 @@ ptr_t arg;
/* thus more junk remains accessible, thus the heap gets */
/* larger ... */
# ifdef THREADS
- BZERO(dummy, CLEAR_SIZE*sizeof(word));
+ if (++random_no % 13 == 0) {
+ limit = sp;
+ MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word));
+ return GC_lear_stack_inner(arg, limit);
+ } else {
+ BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word));
+ return arg;
+ }
# else
if (GC_gc_no > GC_stack_last_cleared) {
/* Start things over, so we clear the entire stack again */