ruby-changes:11506
From: nobu <ko1@a...>
Date: Fri, 3 Apr 2009 18:38:10 +0900 (JST)
Subject: [ruby-changes:11506] Ruby:r23132 (ruby_1_8): * gc.c (Init_stack): use ruby_init_stack.
nobu 2009-04-03 18:38:01 +0900 (Fri, 03 Apr 2009) New Revision: 23132 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23132 Log: * gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350] * intern.h (Init_stack): make to call ruby_init_stack. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/eval.c branches/ruby_1_8/gc.c branches/ruby_1_8/intern.h branches/ruby_1_8/ruby.h Index: ruby_1_8/intern.h =================================================================== --- ruby_1_8/intern.h (revision 23131) +++ ruby_1_8/intern.h (revision 23132) @@ -269,6 +269,7 @@ VALUE rb_gc_enable _((void)); VALUE rb_gc_disable _((void)); VALUE rb_gc_start _((void)); +#define Init_stack(addr) ruby_init_stack(addr) /* hash.c */ void st_foreach_safe _((struct st_table *, int (*)(ANYARGS), unsigned long)); void rb_hash_foreach _((VALUE, int (*)(ANYARGS), VALUE)); Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 23131) +++ ruby_1_8/ChangeLog (revision 23132) @@ -1,3 +1,9 @@ +Fri Apr 3 18:37:59 2009 Nobuyoshi Nakada <nobu@r...> + + * gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350] + + * intern.h (Init_stack): make to call ruby_init_stack. + Fri Apr 3 18:35:03 2009 Nobuyoshi Nakada <nobu@r...> * Makefile.in (fake.rb): creates with config.status. Index: ruby_1_8/ruby.h =================================================================== --- ruby_1_8/ruby.h (revision 23131) +++ ruby_1_8/ruby.h (revision 23132) @@ -595,15 +595,15 @@ #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 Init_stack(addr) ruby_init_stack(addr) #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**)); NORETURN(void ruby_run _((void))); Index: ruby_1_8/eval.c =================================================================== --- ruby_1_8/eval.c (revision 23131) +++ ruby_1_8/eval.c (revision 23132) @@ -1374,7 +1374,6 @@ char **rb_origenviron; void rb_call_inits _((void)); -void Init_stack _((VALUE*)); void Init_heap _((void)); void Init_ext _((void)); @@ -1421,7 +1420,7 @@ rb_origenviron = environ; #endif - Init_stack((void*)&state); + ruby_init_stack((void*)&state); Init_heap(); PUSH_SCOPE(); ruby_scope->local_vars = 0; @@ -1565,7 +1564,7 @@ { int state; - Init_stack((void*)&state); + ruby_init_stack((void*)&state); PUSH_THREAD_TAG(); if ((state = EXEC_TAG()) == 0) { ruby_process_options(argc, argv); @@ -1621,7 +1620,7 @@ errs[1] = ruby_errinfo; ruby_safe_level = 0; - Init_stack((void *)&state); + ruby_init_stack((void *)&state); PUSH_THREAD_TAG(); PUSH_ITER(ITER_NOT); if ((state = EXEC_TAG()) == 0) { @@ -1703,9 +1702,9 @@ int ruby_exec() { - volatile NODE *tmp; + volatile VALUE tmp; - Init_stack((void*)&tmp); + ruby_init_stack(&tmp); return ruby_exec_internal(); } @@ -12649,7 +12648,7 @@ VALUE (*fn)(); void *arg; { - Init_stack((void *)&arg); + ruby_init_stack((void *)&arg); return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread)); } Index: ruby_1_8/gc.c =================================================================== --- ruby_1_8/gc.c (revision 23131) +++ ruby_1_8/gc.c (revision 23132) @@ -1566,77 +1566,26 @@ #endif } +#undef Init_stack + void Init_stack(addr) 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 = (void *)&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; - STACK_LEVEL_MAX = (rlim.rlim_cur - space) / sizeof(VALUE); - } - } -#endif + ruby_init_stack(addr); } +#undef ruby_init_stack + +void +ruby_init_stack(addr #ifdef __ia64 -void ruby_init_stack(addr, bsp) + , bsp +#endif + ) VALUE *addr; +#ifdef __ia64 void *bsp; -#else -void ruby_init_stack(addr) - VALUE *addr; #endif { if (!rb_gc_stack_start || -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/