summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 13:20:24 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 13:20:24 +0200
commitc521d2cf164f9d7e1fa8be9c0b21d223e265fa64 (patch)
tree82fbd7e60e6be39fbabd946717cf065a698cd038 /headers.c
parent7d3768dbd2a1cd4d5c14f773f23aec43bc0651a5 (diff)
gc4.13 tarball importgc4_13
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/headers.c b/headers.c
index a7b6030..89d033e 100644
--- a/headers.c
+++ b/headers.c
@@ -53,7 +53,6 @@ ptr_t GC_scratch_alloc(bytes)
register word bytes;
{
register ptr_t result = scratch_free_ptr;
- register word bytes_needed = bytes;
# ifdef ALIGN_DOUBLE
# define GRANULARITY (2 * sizeof(word))
@@ -71,7 +70,12 @@ register word bytes;
if (bytes_to_get <= bytes) {
/* Undo the damage, and get memory directly */
- ptr_t result = (ptr_t)GET_MEM(bytes);
+ bytes_to_get = bytes;
+# ifdef USE_MMAP
+ bytes_to_get += GC_page_size - 1;
+ bytes_to_get &= ~(GC_page_size - 1);
+# endif
+ result = (ptr_t)GET_MEM(bytes_to_get);
scratch_free_ptr -= bytes;
GC_scratch_last_end_ptr = result + bytes;
return(result);
@@ -82,7 +86,12 @@ register word bytes;
GC_printf0("Out of memory - trying to allocate less\n");
# endif
scratch_free_ptr -= bytes;
- return((ptr_t)GET_MEM(bytes));
+ bytes_to_get = bytes;
+# ifdef USE_MMAP
+ bytes_to_get += GC_page_size - 1;
+ bytes_to_get &= ~(GC_page_size - 1);
+# endif
+ return((ptr_t)GET_MEM(bytes_to_get));
}
scratch_free_ptr = result;
GC_scratch_end_ptr = scratch_free_ptr + bytes_to_get;
@@ -127,7 +136,7 @@ void GC_init_headers()
/* Make sure that there is a bottom level index block for address addr */
/* Return FALSE on failure. */
-static bool get_index(addr)
+static GC_bool get_index(addr)
register word addr;
{
register word hi =
@@ -168,7 +177,7 @@ register word addr;
/* Install a header for block h. */
/* The header is uninitialized. */
/* Returns FALSE on failure. */
-bool GC_install_header(h)
+GC_bool GC_install_header(h)
register struct hblk * h;
{
hdr * result;
@@ -180,7 +189,7 @@ register struct hblk * h;
}
/* Set up forwarding counts for block h of size sz */
-bool GC_install_counts(h, sz)
+GC_bool GC_install_counts(h, sz)
register struct hblk * h;
register word sz; /* bytes */
{