+2011-07-05 Ivan Maidanski <ivmai@mail.ru>
+
+ * misc.c (GC_init): Use HOTTER_THAN (instead of STACK_GROWS_DOWN)
+ for GC_stackbottom assertion.
+ * os_dep.c (GC_enclosing_mapping): Define only if IA64 or
+ INCLUDE_LINUX_THREAD_DESCR; make GC_INNER.
+ * pthread_support.c (GC_enclosing_mapping): Declare (only if
+ INCLUDE_LINUX_THREAD_DESCR).
+ * os_dep.c (GC_get_main_stack_base): Don't call pthread_getattr_np
+ if REDIRECT_MALLOC as the former is observed to call redirected
+ malloc (while GC is not initialized yet) on some Linux platforms.
+ * include/private/gc_priv.h (MAX_HEAP_SECTS): Don't use a smaller
+ value for SMALL_CONFIG if USE_PROC_FOR_LIBRARIES defined.
+
2011-07-05 Ivan Maidanski <ivmai@mail.ru>
* malloc.c (GC_init_lib_bounds): Call GC_init (to ensure GC is
# else
# define MAX_HEAP_SECTS 768 /* Separately added heap sections. */
# endif
-# elif defined(SMALL_CONFIG)
+# elif defined(SMALL_CONFIG) && !defined(USE_PROC_FOR_LIBRARIES)
# define MAX_HEAP_SECTS 128 /* Roughly 256MB (128*2048*1K) */
# elif CPP_WORDSZ > 32
# define MAX_HEAP_SECTS 1024 /* Roughly 8GB */
# if defined(NETBSD) && defined(__ELF__)
GC_init_netbsd_elf();
# endif
-# if !defined(THREADS) || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) \
- || defined(GC_SOLARIS_THREADS)
+# if !defined(THREADS) || defined(GC_PTHREADS) \
+ || defined(GC_WIN32_THREADS) || defined(GC_SOLARIS_THREADS)
if (GC_stackbottom == 0) {
GC_stackbottom = GC_get_main_stack_base();
# if (defined(LINUX) || defined(HPUX)) && defined(IA64)
GC_STATIC_ASSERT(sizeof (signed_word) == sizeof(word));
GC_STATIC_ASSERT(sizeof (struct hblk) == HBLKSIZE);
# ifndef THREADS
-# ifdef STACK_GROWS_DOWN
- GC_ASSERT((word)(&dummy) <= (word)GC_stackbottom);
-# else
- GC_ASSERT((word)(&dummy) >= (word)GC_stackbottom);
-# endif
+ GC_ASSERT(!((word)GC_stackbottom HOTTER_THAN (word)(&dummy)));
# endif
# if !defined(_AUX_SOURCE) || defined(__GNUC__)
GC_STATIC_ASSERT((word)(-1) > (word)0);
return p;
}
-/* Try to read the backing store base from /proc/self/maps. */
-/* Return the bounds of the writable mapping with a 0 major device, */
-/* which includes the address passed as data. */
-/* Return FALSE if there is no such mapping. */
-GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp, ptr_t *endp)
-{
- char *prot;
- ptr_t my_start, my_end;
- unsigned int maj_dev;
- char *maps = GC_get_maps();
- char *buf_ptr = maps;
+#if defined(IA64) || defined(INCLUDE_LINUX_THREAD_DESCR)
+ /* Try to read the backing store base from /proc/self/maps. */
+ /* Return the bounds of the writable mapping with a 0 major device, */
+ /* which includes the address passed as data. */
+ /* Return FALSE if there is no such mapping. */
+ GC_INNER GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp,
+ ptr_t *endp)
+ {
+ char *prot;
+ ptr_t my_start, my_end;
+ unsigned int maj_dev;
+ char *maps = GC_get_maps();
+ char *buf_ptr = maps;
- if (0 == maps) return(FALSE);
- for (;;) {
- buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end,
- &prot, &maj_dev, 0);
-
- if (buf_ptr == NULL) return FALSE;
- if (prot[1] == 'w' && maj_dev == 0) {
- if (my_end > addr && my_start <= addr) {
- *startp = my_start;
- *endp = my_end;
- return TRUE;
- }
+ if (0 == maps) return(FALSE);
+ for (;;) {
+ buf_ptr = GC_parse_map_entry(buf_ptr, &my_start, &my_end,
+ &prot, &maj_dev, 0);
+
+ if (buf_ptr == NULL) return FALSE;
+ if (prot[1] == 'w' && maj_dev == 0) {
+ if (my_end > addr && my_start <= addr) {
+ *startp = my_start;
+ *endp = my_end;
+ return TRUE;
+ }
+ }
}
+ return FALSE;
}
- return FALSE;
-}
+#endif /* IA64 || INCLUDE_LINUX_THREAD_DESCR */
#if defined(REDIRECT_MALLOC)
/* Find the text(code) mapping for the library whose name, after */
{
ptr_t result; /* also used as "dummy" to get the approx. sp value */
# if defined(LINUX) && !defined(NACL) \
- && (defined(USE_GET_STACKBASE_FOR_MAIN) || defined(THREADS))
+ && (defined(USE_GET_STACKBASE_FOR_MAIN) \
+ || (defined(THREADS) && !defined(REDIRECT_MALLOC)))
pthread_attr_t attr;
void *stackaddr;
size_t size;
#ifdef INCLUDE_LINUX_THREAD_DESCR
__thread int GC_dummy_thread_local;
+ GC_INNER GC_bool GC_enclosing_mapping(ptr_t addr,
+ ptr_t *startp, ptr_t *endp);
#endif
/* We hold the allocation lock. */