mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
01f468d138
commit
b2dde8243b
3 changed files with 9 additions and 64 deletions
|
@ -1,4 +1,6 @@
|
|||
Mon Apr 14 12:47:02 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Mon Apr 14 12:52:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350]
|
||||
|
||||
* gc.c (rb_objspace_t): packed globals. [ruby-dev:34348]
|
||||
|
||||
|
|
63
gc.c
63
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
|
||||
|
|
|
@ -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 *);
|
||||
|
|
Loading…
Reference in a new issue