mirror of git://gcc.gnu.org/git/gcc.git
Use thr_stksegment to determine Solaris stack base
* os_dep.c [SOLARIS_STACKBOTTOM] (GC_solaris_stack_base): New function. [!BEOS && !AMIGA && !MSWIN32 && !MSWINCE && !OS2 && !NOSYS && !ECOS] (GC_get_stack_base): Use it. * include/private/gcconfig.h [SPARC && SUNOS5] (SOLARIS_STACKBOTTOM): Define. (STACKBOTTOM, HEURISTIC2): Remove. [I386 && SUNOS5] (SOLARIS_STACKBOTTOM): Define. (STACKBOTTOM): Remove. From-SVN: r196490
This commit is contained in:
parent
9ac0b8414c
commit
6632162b03
|
|
@ -1,3 +1,16 @@
|
||||||
|
2013-03-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
|
* os_dep.c [SOLARIS_STACKBOTTOM] (GC_solaris_stack_base): New
|
||||||
|
function.
|
||||||
|
[!BEOS && !AMIGA && !MSWIN32 && !MSWINCE && !OS2 && !NOSYS &&
|
||||||
|
!ECOS] (GC_get_stack_base): Use it.
|
||||||
|
* include/private/gcconfig.h [SPARC && SUNOS5]
|
||||||
|
(SOLARIS_STACKBOTTOM): Define.
|
||||||
|
(STACKBOTTOM, HEURISTIC2): Remove.
|
||||||
|
[I386 && SUNOS5]
|
||||||
|
(SOLARIS_STACKBOTTOM): Define.
|
||||||
|
(STACKBOTTOM): Remove.
|
||||||
|
|
||||||
2012-11-04 Samuel Thibault <samuel.thibault@gnu.org>
|
2012-11-04 Samuel Thibault <samuel.thibault@gnu.org>
|
||||||
|
|
||||||
* configure.ac: Add stanza for *-*-gnu* threads configuration.
|
* configure.ac: Add stanza for *-*-gnu* threads configuration.
|
||||||
|
|
|
||||||
|
|
@ -927,18 +927,7 @@
|
||||||
# define HEAP_START DATAEND
|
# define HEAP_START DATAEND
|
||||||
# endif
|
# endif
|
||||||
# define PROC_VDB
|
# define PROC_VDB
|
||||||
/* HEURISTIC1 reportedly no longer works under 2.7. */
|
# define SOLARIS_STACKBOTTOM
|
||||||
/* HEURISTIC2 probably works, but this appears to be preferable. */
|
|
||||||
/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
|
|
||||||
/* installations that's undefined. We work around this with a */
|
|
||||||
/* gross hack: */
|
|
||||||
# include <sys/vmparam.h>
|
|
||||||
# ifdef USERLIMIT
|
|
||||||
/* This should work everywhere, but doesn't. */
|
|
||||||
# define STACKBOTTOM USRSTACK
|
|
||||||
# else
|
|
||||||
# define HEURISTIC2
|
|
||||||
# endif
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
|
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
|
||||||
/* getpagesize() appeared to be missing from at least one */
|
/* getpagesize() appeared to be missing from at least one */
|
||||||
|
|
@ -1067,13 +1056,7 @@
|
||||||
extern ptr_t GC_SysVGetDataStart();
|
extern ptr_t GC_SysVGetDataStart();
|
||||||
# define DATASTART GC_SysVGetDataStart(0x1000, _etext)
|
# define DATASTART GC_SysVGetDataStart(0x1000, _etext)
|
||||||
# define DATAEND (_end)
|
# define DATAEND (_end)
|
||||||
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
|
# define SOLARIS_STACKBOTTOM
|
||||||
/* but reportedly breaks under 2.8. It appears that the stack */
|
|
||||||
/* base is a property of the executable, so this should not break */
|
|
||||||
/* old executables. */
|
|
||||||
/* HEURISTIC2 probably works, but this appears to be preferable. */
|
|
||||||
# include <sys/vm.h>
|
|
||||||
# define STACKBOTTOM USRSTACK
|
|
||||||
/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
|
/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
|
||||||
/* It appears to be fixed in 2.8 and 2.9. */
|
/* It appears to be fixed in 2.8 and 2.9. */
|
||||||
# ifdef SOLARIS25_PROC_VDB_BUG_FIXED
|
# ifdef SOLARIS25_PROC_VDB_BUG_FIXED
|
||||||
|
|
|
||||||
|
|
@ -1008,13 +1008,62 @@ ptr_t GC_get_stack_base()
|
||||||
|
|
||||||
#endif /* FREEBSD_STACKBOTTOM */
|
#endif /* FREEBSD_STACKBOTTOM */
|
||||||
|
|
||||||
|
#ifdef SOLARIS_STACKBOTTOM
|
||||||
|
|
||||||
|
# include <thread.h>
|
||||||
|
# include <signal.h>
|
||||||
|
# include <pthread.h>
|
||||||
|
|
||||||
|
/* These variables are used to cache ss_sp value for the primordial */
|
||||||
|
/* thread (it's better not to call thr_stksegment() twice for this */
|
||||||
|
/* thread - see JDK bug #4352906). */
|
||||||
|
static pthread_t stackbase_main_self = 0;
|
||||||
|
/* 0 means stackbase_main_ss_sp value is unset. */
|
||||||
|
static void *stackbase_main_ss_sp = NULL;
|
||||||
|
|
||||||
|
ptr_t GC_solaris_stack_base(void)
|
||||||
|
{
|
||||||
|
stack_t s;
|
||||||
|
pthread_t self = pthread_self();
|
||||||
|
if (self == stackbase_main_self)
|
||||||
|
{
|
||||||
|
/* If the client calls GC_get_stack_base() from the main thread */
|
||||||
|
/* then just return the cached value. */
|
||||||
|
GC_ASSERT(stackbase_main_ss_sp != NULL);
|
||||||
|
return stackbase_main_ss_sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thr_stksegment(&s)) {
|
||||||
|
/* According to the manual, the only failure error code returned */
|
||||||
|
/* is EAGAIN meaning "the information is not available due to the */
|
||||||
|
/* thread is not yet completely initialized or it is an internal */
|
||||||
|
/* thread" - this shouldn't happen here. */
|
||||||
|
ABORT("thr_stksegment failed");
|
||||||
|
}
|
||||||
|
/* s.ss_sp holds the pointer to the stack bottom. */
|
||||||
|
GC_ASSERT((void *)&s HOTTER_THAN s.ss_sp);
|
||||||
|
|
||||||
|
if (!stackbase_main_self)
|
||||||
|
{
|
||||||
|
/* Cache the stack base value for the primordial thread (this */
|
||||||
|
/* is done during GC_init, so there is no race). */
|
||||||
|
stackbase_main_ss_sp = s.ss_sp;
|
||||||
|
stackbase_main_self = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s.ss_sp;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* GC_SOLARIS_THREADS */
|
||||||
|
|
||||||
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
|
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
|
||||||
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS)
|
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS)
|
||||||
|
|
||||||
ptr_t GC_get_stack_base()
|
ptr_t GC_get_stack_base()
|
||||||
{
|
{
|
||||||
# if defined(HEURISTIC1) || defined(HEURISTIC2) || \
|
# if defined(HEURISTIC1) || defined(HEURISTIC2) || \
|
||||||
defined(LINUX_STACKBOTTOM) || defined(FREEBSD_STACKBOTTOM)
|
defined(LINUX_STACKBOTTOM) || defined(FREEBSD_STACKBOTTOM) || \
|
||||||
|
defined(SOLARIS_STACKBOTTOM)
|
||||||
word dummy;
|
word dummy;
|
||||||
ptr_t result;
|
ptr_t result;
|
||||||
# endif
|
# endif
|
||||||
|
|
@ -1040,6 +1089,9 @@ ptr_t GC_get_stack_base()
|
||||||
# ifdef FREEBSD_STACKBOTTOM
|
# ifdef FREEBSD_STACKBOTTOM
|
||||||
result = GC_freebsd_stack_base();
|
result = GC_freebsd_stack_base();
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef SOLARIS_STACKBOTTOM
|
||||||
|
result = GC_solaris_stack_base();
|
||||||
|
# endif
|
||||||
# ifdef HEURISTIC2
|
# ifdef HEURISTIC2
|
||||||
# ifdef STACK_GROWS_DOWN
|
# ifdef STACK_GROWS_DOWN
|
||||||
result = GC_find_limit((ptr_t)(&dummy), TRUE);
|
result = GC_find_limit((ptr_t)(&dummy), TRUE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue