From b2dde8243ba18a68010e4b1f3b720c093a7c48a3 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 14 Apr 2008 03:52:27 +0000 Subject: [PATCH] * gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++- gc.c | 63 +++------------------------------------------ include/ruby/ruby.h | 6 ++--- 3 files changed, 9 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cdc5f0beb..ce29a6b0da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ -Mon Apr 14 12:47:02 2008 Nobuyoshi Nakada +Mon Apr 14 12:52:25 2008 Nobuyoshi Nakada + + * gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350] * gc.c (rb_objspace_t): packed globals. [ruby-dev:34348] diff --git a/gc.c b/gc.c index de006e9a2d..edcd9b099b 100644 --- a/gc.c +++ b/gc.c @@ -1630,67 +1630,12 @@ ruby_set_stack_size(size_t size) void Init_stack(VALUE *addr) { -#ifdef __ia64 - if (rb_gc_register_stack_start == 0) { -# if defined(__FreeBSD__) - /* - * FreeBSD/ia64 currently does not have a way for a process to get the - * base address for the RSE backing store, so hardcode it. - */ - rb_gc_register_stack_start = (4ULL<<61); -# elif defined(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE) -# pragma weak __libc_ia64_register_backing_store_base - extern unsigned long __libc_ia64_register_backing_store_base; - rb_gc_register_stack_start = (VALUE*)__libc_ia64_register_backing_store_base; -# endif - } - { - VALUE *bsp = (VALUE*)rb_ia64_bsp(); - if (rb_gc_register_stack_start == 0 || - bsp < rb_gc_register_stack_start) { - rb_gc_register_stack_start = bsp; - } - } -#endif -#if defined(_WIN32) || defined(__CYGWIN__) - MEMORY_BASIC_INFORMATION m; - memset(&m, 0, sizeof(m)); - VirtualQuery(&m, &m, sizeof(m)); - rb_gc_stack_start = - STACK_UPPER((VALUE *)&m, (VALUE *)m.BaseAddress, - (VALUE *)((char *)m.BaseAddress + m.RegionSize) - 1); -#elif defined(STACK_END_ADDRESS) - { - extern void *STACK_END_ADDRESS; - rb_gc_stack_start = STACK_END_ADDRESS; - } -#else - if (!addr) addr = (VALUE *)&addr; - STACK_UPPER(&addr, addr, ++addr); - if (rb_gc_stack_start) { - if (STACK_UPPER(&addr, - rb_gc_stack_start > addr, - rb_gc_stack_start < addr)) - rb_gc_stack_start = addr; - return; - } - rb_gc_stack_start = addr; -#endif -#ifdef HAVE_GETRLIMIT - { - struct rlimit rlim; - - if (getrlimit(RLIMIT_STACK, &rlim) == 0) { - unsigned int space = rlim.rlim_cur/5; - - if (space > 1024*1024) space = 1024*1024; - rb_gc_stack_maxsize = rlim.rlim_cur - space; - } - } -#endif + ruby_init_stack(addr); } -void ruby_init_stack(VALUE *addr +#undef ruby_init_stack +void +ruby_init_stack(VALUE *addr #ifdef __ia64 , void *bsp #endif diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index c289763841..b5ead8492d 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -823,15 +823,13 @@ VALUE rb_require(const char*); #ifdef __ia64 void ruby_init_stack(VALUE*, void*); -#define RUBY_INIT_STACK \ - VALUE variable_in_this_stack_frame; \ - ruby_init_stack(&variable_in_this_stack_frame, rb_ia64_bsp()); +#define ruby_init_stack(addr) ruby_init_stack(addr, rb_ia64_bsp()) #else void ruby_init_stack(VALUE*); +#endif #define RUBY_INIT_STACK \ VALUE variable_in_this_stack_frame; \ ruby_init_stack(&variable_in_this_stack_frame); -#endif void ruby_init(void); void *ruby_options(int, char**); int ruby_run_node(void *);