aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc/malloc.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/malloc.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/malloc.c')
-rw-r--r--boehm-gc/malloc.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/boehm-gc/malloc.c b/boehm-gc/malloc.c
index 353a9bc9599..cb3f3766386 100644
--- a/boehm-gc/malloc.c
+++ b/boehm-gc/malloc.c
@@ -36,6 +36,7 @@ register struct obj_kind * kind;
/* Allocate a large block of size lw words. */
/* The block is not cleared. */
/* Flags is 0 or IGNORE_OFF_PAGE. */
+/* We hold the allocation lock. */
ptr_t GC_alloc_large(lw, k, flags)
word lw;
int k;
@@ -62,20 +63,21 @@ unsigned flags;
if (h == 0) {
result = 0;
} else {
- int total_bytes = BYTES_TO_WORDS(n_blocks * HBLKSIZE);
+ int total_bytes = n_blocks * HBLKSIZE;
if (n_blocks > 1) {
- GC_large_allocd_bytes += n_blocks * HBLKSIZE;
+ GC_large_allocd_bytes += total_bytes;
if (GC_large_allocd_bytes > GC_max_large_allocd_bytes)
GC_max_large_allocd_bytes = GC_large_allocd_bytes;
}
result = (ptr_t) (h -> hb_body);
- GC_words_wasted += total_bytes - lw;
+ GC_words_wasted += BYTES_TO_WORDS(total_bytes) - lw;
}
return result;
}
/* Allocate a large block of size lb bytes. Clear if appropriate. */
+/* We hold the allocation lock. */
ptr_t GC_alloc_large_and_clear(lw, k, flags)
word lw;
int k;
@@ -311,6 +313,19 @@ DCL_LOCK_STATE;
}
# ifdef REDIRECT_MALLOC
+
+/* Avoid unnecessary nested procedure calls here, by #defining some */
+/* malloc replacements. Otherwise we end up saving a */
+/* meaningless return address in the object. It also speeds things up, */
+/* but it is admittedly quite ugly. */
+# ifdef GC_ADD_CALLER
+# define RA GC_RETURN_ADDR,
+# else
+# define RA
+# endif
+# define GC_debug_malloc_replacement(lb) \
+ GC_debug_malloc(lb, RA "unknown", 0)
+
# ifdef __STDC__
GC_PTR malloc(size_t lb)
# else
@@ -363,6 +378,8 @@ DCL_LOCK_STATE;
/* and thus the right thing will happen even without overriding it. */
/* This seems to be true on most Linux systems. */
+#undef GC_debug_malloc_replacement
+
# endif /* REDIRECT_MALLOC */
/* Explicitly deallocate an object p. */