aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/alloc.c
diff options
context:
space:
mode:
authorBryce McKinlay <mckinlay@redhat.com>2004-08-13 23:05:36 +0000
committerBryce McKinlay <mckinlay@redhat.com>2004-08-13 23:05:36 +0000
commit3fd75d88fc8d100e9050e97ae50c07360cc059aa (patch)
tree863181355c9339e1361dad10263a322aaabe426e /boehm-gc/alloc.c
parentd4bb3defb51b9b60c4ee32d838fda61ef94938a5 (diff)
libjava:
2004-08-13 Bryce McKinlay <mckinlay@redhat.com> * configure.in (GCINCS): Don't use "boehm-cflags". Instead, -I boehm-gc's include dirs. * configure: Rebuilt. * include/boehm-gc.h: Include gc_config.h. boehm-gc: 2004-08-13 Bryce McKinlay <mckinlay@redhat.com> * configure.ac (gc_cflags): Add -Iinclude. (AC_CONFIG_HEADERS): New. Configure gc_config.h header. Don't write DEFS to boehm-cflags file. * configure: Rebuilt. * gcj_mlc.c: Check #ifdef GC_GCJ_SUPPORT after including headers. * specific.c: Check #ifdef GC_LINUX_THREADS after including headers. * include/gc_config_macros.h: Remove backward-compatibility redefinitions of GC_ names. * include/gc.h: Include <gc_config.h>. 2004-08-13 Bryce McKinlay <mckinlay@redhat.com> Import Boehm GC version 6.3. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@85972 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/alloc.c')
-rw-r--r--boehm-gc/alloc.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/boehm-gc/alloc.c b/boehm-gc/alloc.c
index d2b874fc770..1ac6ff8111f 100644
--- a/boehm-gc/alloc.c
+++ b/boehm-gc/alloc.c
@@ -133,7 +133,7 @@ int GC_n_attempts = 0; /* Number of attempts at finishing */
if (GC_print_stats) {
GC_printf0("Abandoning stopped marking after ");
GC_printf1("%lu msecs", (unsigned long)time_diff);
- GC_printf1("(attempt %d)\n", (unsigned long) GC_n_attempts);
+ GC_printf1("(attempt %ld)\n", (unsigned long) GC_n_attempts);
}
# endif
return(1);
@@ -228,10 +228,15 @@ void GC_clear_a_few_frames()
for (i = 0; i < NWORDS; i++) frames[i] = 0;
}
+/* Heap size at which we need a collection to avoid expanding past */
+/* limits used by blacklisting. */
+static word GC_collect_at_heapsize = (word)(-1);
+
/* Have we allocated enough to amortize a collection? */
GC_bool GC_should_collect()
{
- return(GC_adj_words_allocd() >= min_words_allocd());
+ return(GC_adj_words_allocd() >= min_words_allocd()
+ || GC_heapsize >= GC_collect_at_heapsize);
}
@@ -924,25 +929,37 @@ word n;
# endif
}
# endif
- expansion_slop = 8 * WORDS_TO_BYTES(min_words_allocd());
- if (5 * HBLKSIZE * MAXHINCR > expansion_slop) {
- expansion_slop = 5 * HBLKSIZE * MAXHINCR;
- }
+ expansion_slop = WORDS_TO_BYTES(min_words_allocd()) + 4*MAXHINCR*HBLKSIZE;
if (GC_last_heap_addr == 0 && !((word)space & SIGNB)
|| GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space) {
/* Assume the heap is growing up */
GC_greatest_plausible_heap_addr =
- GC_max(GC_greatest_plausible_heap_addr,
- (ptr_t)space + bytes + expansion_slop);
+ (GC_PTR)GC_max((ptr_t)GC_greatest_plausible_heap_addr,
+ (ptr_t)space + bytes + expansion_slop);
} else {
/* Heap is growing down */
GC_least_plausible_heap_addr =
- GC_min(GC_least_plausible_heap_addr,
- (ptr_t)space - expansion_slop);
+ (GC_PTR)GC_min((ptr_t)GC_least_plausible_heap_addr,
+ (ptr_t)space - expansion_slop);
}
+# if defined(LARGE_CONFIG)
+ if (((ptr_t)GC_greatest_plausible_heap_addr <= (ptr_t)space + bytes
+ || (ptr_t)GC_least_plausible_heap_addr >= (ptr_t)space)
+ && GC_heapsize > 0) {
+ /* GC_add_to_heap will fix this, but ... */
+ WARN("Too close to address space limit: blacklisting ineffective\n", 0);
+ }
+# endif
GC_prev_heap_addr = GC_last_heap_addr;
GC_last_heap_addr = (ptr_t)space;
GC_add_to_heap(space, bytes);
+ /* Force GC before we are likely to allocate past expansion_slop */
+ GC_collect_at_heapsize =
+ GC_heapsize + expansion_slop - 2*MAXHINCR*HBLKSIZE;
+# if defined(LARGE_CONFIG)
+ if (GC_collect_at_heapsize < GC_heapsize /* wrapped */)
+ GC_collect_at_heapsize = (word)(-1);
+# endif
return(TRUE);
}