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>
|
Fri Apr 3 18:35:03 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* Makefile.in (fake.rb): creates with config.status.
|
* Makefile.in (fake.rb): creates with config.status.
|
||||||
|
|
13
eval.c
13
eval.c
|
@ -1374,7 +1374,6 @@ extern char **environ;
|
||||||
char **rb_origenviron;
|
char **rb_origenviron;
|
||||||
|
|
||||||
void rb_call_inits _((void));
|
void rb_call_inits _((void));
|
||||||
void Init_stack _((VALUE*));
|
|
||||||
void Init_heap _((void));
|
void Init_heap _((void));
|
||||||
void Init_ext _((void));
|
void Init_ext _((void));
|
||||||
|
|
||||||
|
@ -1421,7 +1420,7 @@ ruby_init()
|
||||||
rb_origenviron = environ;
|
rb_origenviron = environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Init_stack((void*)&state);
|
ruby_init_stack((void*)&state);
|
||||||
Init_heap();
|
Init_heap();
|
||||||
PUSH_SCOPE();
|
PUSH_SCOPE();
|
||||||
ruby_scope->local_vars = 0;
|
ruby_scope->local_vars = 0;
|
||||||
|
@ -1565,7 +1564,7 @@ ruby_options(argc, argv)
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
Init_stack((void*)&state);
|
ruby_init_stack((void*)&state);
|
||||||
PUSH_THREAD_TAG();
|
PUSH_THREAD_TAG();
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
ruby_process_options(argc, argv);
|
ruby_process_options(argc, argv);
|
||||||
|
@ -1621,7 +1620,7 @@ ruby_cleanup(ex)
|
||||||
|
|
||||||
errs[1] = ruby_errinfo;
|
errs[1] = ruby_errinfo;
|
||||||
ruby_safe_level = 0;
|
ruby_safe_level = 0;
|
||||||
Init_stack((void *)&state);
|
ruby_init_stack((void *)&state);
|
||||||
PUSH_THREAD_TAG();
|
PUSH_THREAD_TAG();
|
||||||
PUSH_ITER(ITER_NOT);
|
PUSH_ITER(ITER_NOT);
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
|
@ -1703,9 +1702,9 @@ ruby_stop(ex)
|
||||||
int
|
int
|
||||||
ruby_exec()
|
ruby_exec()
|
||||||
{
|
{
|
||||||
volatile NODE *tmp;
|
volatile VALUE tmp;
|
||||||
|
|
||||||
Init_stack((void*)&tmp);
|
ruby_init_stack(&tmp);
|
||||||
return ruby_exec_internal();
|
return ruby_exec_internal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12649,7 +12648,7 @@ rb_thread_create(fn, arg)
|
||||||
VALUE (*fn)();
|
VALUE (*fn)();
|
||||||
void *arg;
|
void *arg;
|
||||||
{
|
{
|
||||||
Init_stack((void *)&arg);
|
ruby_init_stack((void *)&arg);
|
||||||
return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef Init_stack
|
||||||
|
|
||||||
void
|
void
|
||||||
Init_stack(addr)
|
Init_stack(addr)
|
||||||
VALUE *addr;
|
VALUE *addr;
|
||||||
{
|
{
|
||||||
#ifdef __ia64
|
ruby_init_stack(addr);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef ruby_init_stack
|
||||||
|
|
||||||
|
void
|
||||||
|
ruby_init_stack(addr
|
||||||
#ifdef __ia64
|
#ifdef __ia64
|
||||||
void ruby_init_stack(addr, bsp)
|
, bsp
|
||||||
|
#endif
|
||||||
|
)
|
||||||
VALUE *addr;
|
VALUE *addr;
|
||||||
|
#ifdef __ia64
|
||||||
void *bsp;
|
void *bsp;
|
||||||
#else
|
|
||||||
void ruby_init_stack(addr)
|
|
||||||
VALUE *addr;
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (!rb_gc_stack_start ||
|
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_enable _((void));
|
||||||
VALUE rb_gc_disable _((void));
|
VALUE rb_gc_disable _((void));
|
||||||
VALUE rb_gc_start _((void));
|
VALUE rb_gc_start _((void));
|
||||||
|
#define Init_stack(addr) ruby_init_stack(addr)
|
||||||
/* hash.c */
|
/* hash.c */
|
||||||
void st_foreach_safe _((struct st_table *, int (*)(ANYARGS), unsigned long));
|
void st_foreach_safe _((struct st_table *, int (*)(ANYARGS), unsigned long));
|
||||||
void rb_hash_foreach _((VALUE, int (*)(ANYARGS), VALUE));
|
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
|
#ifdef __ia64
|
||||||
void ruby_init_stack(VALUE*, void*);
|
void ruby_init_stack(VALUE*, void*);
|
||||||
#define RUBY_INIT_STACK \
|
#define ruby_init_stack(addr) ruby_init_stack(addr, rb_ia64_bsp())
|
||||||
VALUE variable_in_this_stack_frame; \
|
|
||||||
ruby_init_stack(&variable_in_this_stack_frame, rb_ia64_bsp());
|
|
||||||
#else
|
#else
|
||||||
void ruby_init_stack(VALUE*);
|
void ruby_init_stack(VALUE*);
|
||||||
|
#endif
|
||||||
|
#define Init_stack(addr) ruby_init_stack(addr)
|
||||||
#define RUBY_INIT_STACK \
|
#define RUBY_INIT_STACK \
|
||||||
VALUE variable_in_this_stack_frame; \
|
VALUE variable_in_this_stack_frame; \
|
||||||
ruby_init_stack(&variable_in_this_stack_frame);
|
ruby_init_stack(&variable_in_this_stack_frame);
|
||||||
#endif
|
|
||||||
void ruby_init _((void));
|
void ruby_init _((void));
|
||||||
void ruby_options _((int, char**));
|
void ruby_options _((int, char**));
|
||||||
NORETURN(void ruby_run _((void)));
|
NORETURN(void ruby_run _((void)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue