ggc-page.c (alloc_annon): Call perror and correctly call exit.

* ggc-page.c (alloc_annon): Call perror and correctly call exit.
	(alloc_page, ggc_alloc): Add casts to remove warnings.

From-SVN: r39008
This commit is contained in:
Richard Kenner 2001-01-14 11:22:12 +00:00 committed by Richard Kenner
parent aa6683f7f1
commit bd0f0717f1
2 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,8 @@
Sun Jan 14 06:20:49 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* ggc-page.c (alloc_annon): Call perror and correctly call exit.
(alloc_page, ggc_alloc): Add casts to remove warnings.
2001-01-14 Geoffrey Keating <geoffk@redhat.com> 2001-01-14 Geoffrey Keating <geoffk@redhat.com>
* combine.c (simplify_comparison): Don't change `code' when * combine.c (simplify_comparison): Don't change `code' when

View File

@ -355,7 +355,6 @@ static struct globals
free list. This cannot be larger than HOST_BITS_PER_INT for the free list. This cannot be larger than HOST_BITS_PER_INT for the
in_use bitmask for page_group. */ in_use bitmask for page_group. */
#define GGC_QUIRE_SIZE 16 #define GGC_QUIRE_SIZE 16
static int ggc_allocated_p PARAMS ((const void *)); static int ggc_allocated_p PARAMS ((const void *));
static page_entry *lookup_page_table_entry PARAMS ((const void *)); static page_entry *lookup_page_table_entry PARAMS ((const void *));
@ -519,8 +518,8 @@ alloc_anon (pref, size)
if (page == (char *) MAP_FAILED) if (page == (char *) MAP_FAILED)
{ {
fputs ("Virtual memory exhausted!\n", stderr); perror ("Virtual memory exhausted");
exit(1); exit (FATAL_EXIT_CODE);
} }
/* Remember that we allocated this memory. */ /* Remember that we allocated this memory. */
@ -587,7 +586,7 @@ alloc_page (order)
page = NULL; page = NULL;
/* Check the list of free pages for one we can use. */ /* Check the list of free pages for one we can use. */
for (pp = &G.free_pages, p = *pp; p ; pp = &p->next, p = *pp) for (pp = &G.free_pages, p = *pp; p; pp = &p->next, p = *pp)
if (p->bytes == entry_size) if (p->bytes == entry_size)
break; break;
@ -596,9 +595,11 @@ alloc_page (order)
/* Recycle the allocated memory from this page ... */ /* Recycle the allocated memory from this page ... */
*pp = p->next; *pp = p->next;
page = p->page; page = p->page;
#ifdef USING_MALLOC_PAGE_GROUPS #ifdef USING_MALLOC_PAGE_GROUPS
group = p->group; group = p->group;
#endif #endif
/* ... and, if possible, the page entry itself. */ /* ... and, if possible, the page entry itself. */
if (p->order == order) if (p->order == order)
{ {
@ -618,6 +619,7 @@ alloc_page (order)
int i; int i;
page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE); page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE);
/* This loop counts down so that the chain will be in ascending /* This loop counts down so that the chain will be in ascending
memory order. */ memory order. */
for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--) for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--)
@ -629,6 +631,7 @@ alloc_page (order)
e->next = f; e->next = f;
f = e; f = e;
} }
G.free_pages = f; G.free_pages = f;
} }
else else
@ -730,8 +733,9 @@ alloc_page (order)
if (GGC_DEBUG_LEVEL >= 2) if (GGC_DEBUG_LEVEL >= 2)
fprintf (G.debug_file, fprintf (G.debug_file,
"Allocating page at %p, object size=%d, data %p-%p\n", "Allocating page at %p, object size=%ld, data %p-%p\n",
(PTR) entry, OBJECT_SIZE (order), page, page + entry_size - 1); (PTR) entry, (long) OBJECT_SIZE (order), page,
page + entry_size - 1);
return entry; return entry;
} }
@ -951,8 +955,8 @@ ggc_alloc (size)
if (GGC_DEBUG_LEVEL >= 3) if (GGC_DEBUG_LEVEL >= 3)
fprintf (G.debug_file, fprintf (G.debug_file,
"Allocating object, requested size=%d, actual=%d at %p on %p\n", "Allocating object, requested size=%ld, actual=%ld at %p on %p\n",
(int) size, OBJECT_SIZE (order), result, (PTR) entry); (long) size, (long) OBJECT_SIZE (order), result, (PTR) entry);
return result; return result;
} }