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]
* intern.h (Init_stack): make to call ruby_init_stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1662ff8917
commit
3175b6e7bb
5 changed files with 28 additions and 73 deletions
|
@ -1,3 +1,9 @@
|
|||
Fri Apr 3 18:37:59 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* Makefile.in (fake.rb): creates with config.status.
|
||||
|
|
13
eval.c
13
eval.c
|
@ -1374,7 +1374,6 @@ extern char **environ;
|
|||
char **rb_origenviron;
|
||||
|
||||
void rb_call_inits _((void));
|
||||
void Init_stack _((VALUE*));
|
||||
void Init_heap _((void));
|
||||
void Init_ext _((void));
|
||||
|
||||
|
@ -1421,7 +1420,7 @@ ruby_init()
|
|||
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 @@ ruby_options(argc, argv)
|
|||
{
|
||||
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 @@ ruby_cleanup(ex)
|
|||
|
||||
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 @@ ruby_stop(ex)
|
|||
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 @@ rb_thread_create(fn, arg)
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
73
gc.c
73
gc.c
|
@ -1566,77 +1566,26 @@ ruby_set_stack_size(size)
|
|||
#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 ||
|
||||
|
|
1
intern.h
1
intern.h
|
@ -269,6 +269,7 @@ void rb_gc_call_finalizer_at_exit _((void));
|
|||
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));
|
||||
|
|
8
ruby.h
8
ruby.h
|
@ -595,15 +595,15 @@ 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 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)));
|
||||
|
|
Loading…
Add table
Reference in a new issue