merge revision(s) r44712,r44715,r44716,r44722,r44725,r44726,r44753: [Backport #9454] [Backport #9828]

* thread_pthread.c: get current main thread stack size, which may
	  be expanded than allocated size at initialization, by rlimit().
	  [ruby-core:60113] [Bug #9454]

	* thread_pthread.c: rlimit is only available on Linux.
	  At least r44712 breaks FreeBSD.
	  [ruby-core:60113] [Bug #9454]

	* thread_pthread.c (ruby_init_stack, ruby_stack_overflowed_p):
	  place get_stack above others to get stack boundary information.
	  [ruby-core:60113] [Bug #9454]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2014-06-19 15:56:56 +00:00
parent 0c5503923b
commit ced638cc0f
10 changed files with 179 additions and 137 deletions

View file

@ -121,7 +121,7 @@ static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_regio
#ifdef __ia64
#define RB_GC_SAVE_MACHINE_REGISTER_STACK(th) \
do{(th)->machine_register_stack_end = rb_ia64_bsp();}while(0)
do{(th)->machine.register_stack_end = rb_ia64_bsp();}while(0)
#else
#define RB_GC_SAVE_MACHINE_REGISTER_STACK(th)
#endif
@ -129,8 +129,8 @@ static inline void blocking_region_end(rb_thread_t *th, struct rb_blocking_regio
do { \
FLUSH_REGISTER_WINDOWS; \
RB_GC_SAVE_MACHINE_REGISTER_STACK(th); \
setjmp((th)->machine_regs); \
SET_MACHINE_STACK_END(&(th)->machine_stack_end); \
setjmp((th)->machine.regs); \
SET_MACHINE_STACK_END(&(th)->machine.stack_end); \
} while (0)
#define GVL_UNLOCK_BEGIN() do { \
@ -465,9 +465,9 @@ thread_cleanup_func_before_exec(void *th_ptr)
{
rb_thread_t *th = th_ptr;
th->status = THREAD_KILLED;
th->machine_stack_start = th->machine_stack_end = 0;
th->machine.stack_start = th->machine.stack_end = 0;
#ifdef __ia64
th->machine_register_stack_start = th->machine_register_stack_end = 0;
th->machine.register_stack_start = th->machine.register_stack_end = 0;
#endif
}
@ -519,9 +519,9 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
ruby_thread_set_native(th);
th->machine_stack_start = stack_start;
th->machine.stack_start = stack_start;
#ifdef __ia64
th->machine_register_stack_start = register_stack_start;
th->machine.register_stack_start = register_stack_start;
#endif
thread_debug("thread start: %p\n", (void *)th);