aclocal.m4 (AC_FUNC_MMAP_ZERO): New macro.
* aclocal.m4 (AC_FUNC_MMAP_ZERO): New macro. * configure.in (AC_FUNC_MMAP_ZERO): Use instead of AC_FUNC_MMAP. * ggc-page.c: Replace HAVE_MMAP with HAVE_MMAP_ZERO. * configure, config.in: Rebuilt. From-SVN: r31444
This commit is contained in:
parent
08439bec5f
commit
4acab94bfa
@ -1,3 +1,10 @@
|
||||
2000-01-16 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
|
||||
|
||||
* aclocal.m4 (AC_FUNC_MMAP_ZERO): New macro.
|
||||
* configure.in (AC_FUNC_MMAP_ZERO): Use instead of AC_FUNC_MMAP.
|
||||
* ggc-page.c: Replace HAVE_MMAP with HAVE_MMAP_ZERO.
|
||||
* configure, config.in: Rebuilt.
|
||||
|
||||
2000-01-16 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* config/i386/i386.md: Add peephole to merge successive stack
|
||||
|
82
gcc/aclocal.m4
vendored
82
gcc/aclocal.m4
vendored
@ -680,3 +680,85 @@ else
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether mmap can map an arbitrary page from /dev/zero, without
|
||||
# MAP_FIXED.
|
||||
AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
|
||||
[AC_CHECK_HEADERS(unistd.h)
|
||||
AC_CHECK_FUNCS(getpagesize)
|
||||
AC_CACHE_CHECK(for working mmap from /dev/zero, ac_cv_func_mmap_zero,
|
||||
[AC_TRY_RUN([
|
||||
/* Test by Richard Henderson and Alexandre Oliva.
|
||||
Check whether mmap from /dev/zero works. */
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
/* This mess was copied from the GNU getpagesize.h. */
|
||||
#ifndef HAVE_GETPAGESIZE
|
||||
# ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
/* Assume that all systems that can run configure have sys/param.h. */
|
||||
# ifndef HAVE_SYS_PARAM_H
|
||||
# define HAVE_SYS_PARAM_H 1
|
||||
# endif
|
||||
|
||||
# ifdef _SC_PAGESIZE
|
||||
# define getpagesize() sysconf(_SC_PAGESIZE)
|
||||
# else /* no _SC_PAGESIZE */
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# ifdef EXEC_PAGESIZE
|
||||
# define getpagesize() EXEC_PAGESIZE
|
||||
# else /* no EXEC_PAGESIZE */
|
||||
# ifdef NBPG
|
||||
# define getpagesize() NBPG * CLSIZE
|
||||
# ifndef CLSIZE
|
||||
# define CLSIZE 1
|
||||
# endif /* no CLSIZE */
|
||||
# else /* no NBPG */
|
||||
# ifdef NBPC
|
||||
# define getpagesize() NBPC
|
||||
# else /* no NBPC */
|
||||
# ifdef PAGESIZE
|
||||
# define getpagesize() PAGESIZE
|
||||
# endif /* PAGESIZE */
|
||||
# endif /* no NBPC */
|
||||
# endif /* no NBPG */
|
||||
# endif /* no EXEC_PAGESIZE */
|
||||
# else /* no HAVE_SYS_PARAM_H */
|
||||
# define getpagesize() 8192 /* punt totally */
|
||||
# endif /* no HAVE_SYS_PARAM_H */
|
||||
# endif /* no _SC_PAGESIZE */
|
||||
|
||||
#endif /* no HAVE_GETPAGESIZE */
|
||||
|
||||
int main()
|
||||
{
|
||||
char *x;
|
||||
int fd, pg;
|
||||
|
||||
fd = open("/dev/zero", O_RDWR);
|
||||
if (fd < 0)
|
||||
exit(1);
|
||||
|
||||
pg = getpagesize();
|
||||
x = (char*)mmap(0, pg, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
|
||||
if (x == (char *) -1)
|
||||
exit(2);
|
||||
|
||||
*(int *)x += 1;
|
||||
|
||||
if (munmap(x, pg) < 0)
|
||||
exit(3);
|
||||
|
||||
exit(0);
|
||||
}], ac_cv_func_mmap_anywhere=yes, ac_cv_func_mmap_anywhere=no,
|
||||
ac_cv_func_mmap_anywhere=no)])
|
||||
if test $ac_cv_func_mmap_anywhere = yes; then
|
||||
AC_DEFINE(HAVE_MMAP_ANYWHERE, 1,
|
||||
[Define if mmap can get us zeroed pages from /dev/zero.])
|
||||
fi
|
||||
])
|
||||
|
@ -415,3 +415,7 @@
|
||||
|
||||
/* Define if you have the i library (-li). */
|
||||
#undef HAVE_LIBI
|
||||
|
||||
/* Define if mmap can get us zeroed pages from /dev/zero. */
|
||||
#undef HAVE_MMAP_ANYWHERE
|
||||
|
||||
|
595
gcc/configure
vendored
595
gcc/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -405,7 +405,7 @@ case "${host}" in
|
||||
;;
|
||||
esac
|
||||
AC_FUNC_VFORK
|
||||
AC_FUNC_MMAP
|
||||
AC_FUNC_MMAP_ANYWHERE
|
||||
|
||||
GCC_NEED_DECLARATIONS(bcopy bzero bcmp \
|
||||
index rindex getenv atol sbrk abort atof strerror getcwd getwd \
|
||||
@ -4578,9 +4578,8 @@ AC_ARG_WITH(gc,
|
||||
AC_MSG_ERROR([$withval is an invalid option to --with-gc])
|
||||
;;
|
||||
esac],
|
||||
[if test $ac_cv_func_mmap_fixed_mapped = yes; then
|
||||
GGC=ggc-page
|
||||
elif test $ac_cv_func_valloc = yes; then
|
||||
[if test $ac_cv_func_mmap_anywhere = yes \
|
||||
|| test $ac_cv_func_valloc = yes; then
|
||||
GGC=ggc-page
|
||||
else
|
||||
GGC=ggc-simple
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* "Bag-of-pages" garbage collector for the GNU compiler.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "flags.h"
|
||||
#include "ggc.h"
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_ANYWHERE
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
@ -229,7 +229,7 @@ static struct globals
|
||||
unsigned char context_depth;
|
||||
|
||||
/* A file descriptor open to /dev/zero for reading. */
|
||||
#if defined (HAVE_MMAP) && !defined(MAP_ANONYMOUS)
|
||||
#if defined (HAVE_MMAP_ANYWHERE) && !defined(MAP_ANONYMOUS)
|
||||
int dev_zero_fd;
|
||||
#endif
|
||||
|
||||
@ -408,7 +408,7 @@ alloc_anon (pref, size)
|
||||
{
|
||||
char *page;
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_ANYWHERE
|
||||
#ifdef MAP_ANONYMOUS
|
||||
page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
@ -430,7 +430,7 @@ alloc_anon (pref, size)
|
||||
exit(1);
|
||||
}
|
||||
#endif /* HAVE_VALLOC */
|
||||
#endif /* HAVE_MMAP */
|
||||
#endif /* HAVE_MMAP_ANYWHERE */
|
||||
|
||||
/* Remember that we allocated this memory. */
|
||||
G.bytes_mapped += size;
|
||||
@ -533,7 +533,7 @@ free_page (entry)
|
||||
static void
|
||||
release_pages ()
|
||||
{
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_ANYWHERE
|
||||
page_entry *p, *next;
|
||||
char *start;
|
||||
size_t len;
|
||||
@ -579,7 +579,7 @@ release_pages ()
|
||||
free (p);
|
||||
}
|
||||
#endif /* HAVE_VALLOC */
|
||||
#endif /* HAVE_MMAP */
|
||||
#endif /* HAVE_MMAP_ANYWHERE */
|
||||
|
||||
G.free_pages = NULL;
|
||||
}
|
||||
@ -794,7 +794,7 @@ init_ggc ()
|
||||
G.pagesize = getpagesize();
|
||||
G.lg_pagesize = exact_log2 (G.pagesize);
|
||||
|
||||
#if defined (HAVE_MMAP) && !defined(MAP_ANONYMOUS)
|
||||
#if defined (HAVE_MMAP_ANYWHERE) && !defined(MAP_ANONYMOUS)
|
||||
G.dev_zero_fd = open ("/dev/zero", O_RDONLY);
|
||||
if (G.dev_zero_fd == -1)
|
||||
abort ();
|
||||
@ -808,7 +808,7 @@ init_ggc ()
|
||||
|
||||
G.allocated_last_gc = GGC_MIN_LAST_ALLOCATED;
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_ANYWHERE
|
||||
/* StunOS has an amazing off-by-one error for the first mmap allocation
|
||||
after fiddling with RLIMIT_STACK. The result, as hard as it is to
|
||||
believe, is an unaligned page allocation, which would cause us to
|
||||
|
Loading…
Reference in New Issue
Block a user