Skip to content

Commit

Permalink
* gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350]
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Apr 14, 2008
1 parent 01f468d commit b2dde82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 64 deletions.
4 changes: 3 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Mon Apr 14 12:47:02 2008 Nobuyoshi Nakada <[email protected]>
Mon Apr 14 12:52:25 2008 Nobuyoshi Nakada <[email protected]>

* gc.c (Init_stack): use ruby_init_stack. [ruby-dev:34350]

* gc.c (rb_objspace_t): packed globals. [ruby-dev:34348]

Expand Down
63 changes: 4 additions & 59 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions include/ruby/ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down

0 comments on commit b2dde82

Please sign in to comment.