summaryrefslogtreecommitdiffstats
path: root/boehm-gc/solaris_threads.c
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-12 04:37:57 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-12 04:37:57 +0000
commit0cc01484c3f8c9ec4fec760501aec318bc199adf (patch)
treecef3197531d988920cbff060bdc10742baf06d01 /boehm-gc/solaris_threads.c
parentb6c37935d39c0aadd3d6eefb9e09c455c6cbd0a5 (diff)
downloadppe42-gcc-0cc01484c3f8c9ec4fec760501aec318bc199adf.tar.gz
ppe42-gcc-0cc01484c3f8c9ec4fec760501aec318bc199adf.zip
Imported GC 6.1 Alpha 3. Finally.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/solaris_threads.c')
-rw-r--r--boehm-gc/solaris_threads.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/boehm-gc/solaris_threads.c b/boehm-gc/solaris_threads.c
index 11b0e0375f6..2b520d3d085 100644
--- a/boehm-gc/solaris_threads.c
+++ b/boehm-gc/solaris_threads.c
@@ -16,7 +16,7 @@
*/
/* Boehm, September 14, 1994 4:44 pm PDT */
-# if defined(GC_SOLARIS_THREADS)
+# if defined(GC_SOLARIS_THREADS) || defined(GC_SOLARIS_PTHREADS)
# include "private/gc_priv.h"
# include "private/solaris_threads.h"
@@ -414,7 +414,6 @@ GC_bool GC_thr_initialized = FALSE;
size_t GC_min_stack_sz;
-size_t GC_page_sz;
/*
* stack_head is stored at the top of free stacks
@@ -456,7 +455,7 @@ ptr_t GC_stack_alloc(size_t * stack_size)
GC_stack_free_lists[index] = GC_stack_free_lists[index]->next;
} else {
#ifdef MMAP_STACKS
- base = (ptr_t)mmap(0, search_sz + GC_page_sz,
+ base = (ptr_t)mmap(0, search_sz + GC_page_size,
PROT_READ|PROT_WRITE, MAP_PRIVATE |MAP_NORESERVE,
GC_zfd, 0);
if (base == (ptr_t)-1)
@@ -465,27 +464,27 @@ ptr_t GC_stack_alloc(size_t * stack_size)
return NULL;
}
- mprotect(base, GC_page_sz, PROT_NONE);
- /* Should this use divHBLKSZ(search_sz + GC_page_sz) ? -- cf */
+ mprotect(base, GC_page_size, PROT_NONE);
+ /* Should this use divHBLKSZ(search_sz + GC_page_size) ? -- cf */
GC_is_fresh((struct hblk *)base, divHBLKSZ(search_sz));
- base += GC_page_sz;
+ base += GC_page_size;
#else
- base = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_sz);
+ base = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_size);
if (base == NULL)
{
*stack_size = 0;
return NULL;
}
- base = (ptr_t)(((word)base + GC_page_sz) & ~(GC_page_sz - 1));
+ base = (ptr_t)(((word)base + GC_page_size) & ~(GC_page_size - 1));
/* Protect hottest page to detect overflow. */
# ifdef SOLARIS23_MPROTECT_BUG_FIXED
- mprotect(base, GC_page_sz, PROT_NONE);
+ mprotect(base, GC_page_size, PROT_NONE);
# endif
GC_is_fresh((struct hblk *)base, divHBLKSZ(search_sz));
- base += GC_page_sz;
+ base += GC_page_size;
#endif
}
*stack_size = search_sz;
@@ -665,8 +664,8 @@ void GC_my_stack_limits()
/* original thread */
/* Empirically, what should be the stack page with lowest */
/* address is actually inaccessible. */
- stack_size = GC_get_orig_stack_size() - GC_page_sz;
- stack = GC_stackbottom - stack_size + GC_page_sz;
+ stack_size = GC_get_orig_stack_size() - GC_page_size;
+ stack = GC_stackbottom - stack_size + GC_page_size;
} else {
stack = me -> stack;
}
@@ -704,7 +703,7 @@ void GC_push_all_stacks()
top = p -> stack + p -> stack_size;
} else {
/* The original stack. */
- bottom = GC_stackbottom - GC_get_orig_stack_size() + GC_page_sz;
+ bottom = GC_stackbottom - GC_get_orig_stack_size() + GC_page_size;
top = GC_stackbottom;
}
if ((word)sp > (word)bottom && (word)sp < (word)top) bottom = sp;
@@ -789,7 +788,6 @@ void GC_thr_init(void)
GC_thr_initialized = TRUE;
GC_min_stack_sz = ((thr_min_stack() + 32*1024 + HBLKSIZE-1)
& ~(HBLKSIZE - 1));
- GC_page_sz = sysconf(_SC_PAGESIZE);
#ifdef MMAP_STACKS
GC_zfd = open("/dev/zero", O_RDONLY);
if (GC_zfd == -1)
@@ -911,10 +909,7 @@ GC_thr_create(void *stack_base, size_t stack_size,
void * stack = stack_base;
LOCK();
- if (!GC_thr_initialized)
- {
- GC_thr_init();
- }
+ if (!GC_is_initialized) GC_init_inner();
GC_multithreaded++;
if (stack == 0) {
if (stack_size == 0) stack_size = 1024*1024;
OpenPOWER on IntegriCloud