mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* common.mk, configure.in, defines.h, eval.c, gc.c, main.c,
numeric.c, ruby.h, ia64.s: backport IA64 HP-UX support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2712989175
commit
53cec657a1
9 changed files with 263 additions and 144 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Sep 2 03:36:22 2006 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* common.mk, configure.in, defines.h, eval.c, gc.c, main.c,
|
||||
numeric.c, ruby.h, ia64.s: backport IA64 HP-UX support.
|
||||
|
||||
Fri Sep 1 13:52:57 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk/font.rb: TkFont#current_configinfo() doesn't work
|
||||
|
|
|
@ -189,6 +189,7 @@ nt.$(OBJEXT): {$(VPATH)}nt.c
|
|||
x68.$(OBJEXT): {$(VPATH)}x68.c
|
||||
os2.$(OBJEXT): {$(VPATH)}os2.c
|
||||
dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
|
||||
ia64.$(OBJEXT): ia64.s
|
||||
|
||||
# when I use -I., there is confliction at "OpenFile"
|
||||
# so, set . into environment varible "include"
|
||||
|
|
61
configure.in
61
configure.in
|
@ -286,16 +286,42 @@ if test "$rb_cv_stdarg" = yes; then
|
|||
AC_DEFINE(HAVE_STDARG_PROTOTYPES)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for noreturn], rb_cv_noreturn,
|
||||
[rb_cv_noreturn=x
|
||||
for mac in "x __attribute__ ((noreturn))" "__declspec(noreturn) x" x; do
|
||||
AC_DEFUN([RUBY_FUNC_ATTRIBUTE], [dnl
|
||||
m4_ifval([$2], dnl
|
||||
[AS_VAR_PUSHDEF([attrib],[$2])], dnl
|
||||
[AS_VAR_PUSHDEF([attrib],[FUNC_]AS_TR_CPP($1))] dnl
|
||||
)dnl
|
||||
m4_ifval([$3], dnl
|
||||
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
|
||||
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
|
||||
)dnl
|
||||
AC_CACHE_CHECK(for [$1] function attribute, rbcv,
|
||||
[rbcv=x
|
||||
if test "${ac_c_werror_flag+set}"; then
|
||||
rb_c_werror_flag="$ac_c_werror_flag"
|
||||
else
|
||||
unset rb_c_werror_flag
|
||||
fi
|
||||
ac_c_werror_flag=yes
|
||||
for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
|
||||
AC_TRY_COMPILE(
|
||||
[#define NORETURN(x) $mac
|
||||
NORETURN(void exit(int x));],
|
||||
[],
|
||||
[rb_cv_noreturn="$mac"; break])
|
||||
done])
|
||||
AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn)
|
||||
[#define ]attrib[(x) $mac
|
||||
]attrib[(void conftest_attribute_check(void));], [],
|
||||
[rbcv="$mac"; break])
|
||||
done
|
||||
if test "${rb_c_werror_flag+set}"; then
|
||||
ac_c_werror_flag="$rb_c_werror_flag"
|
||||
else
|
||||
unset ac_c_werror_flag
|
||||
fi
|
||||
])
|
||||
AC_DEFINE_UNQUOTED(attrib[(x)], $rbcv)
|
||||
AS_VAR_POPDEF([attrib])
|
||||
AS_VAR_POPDEF([rbcv])
|
||||
])
|
||||
|
||||
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
|
||||
RUBY_FUNC_ATTRIBUTE(noinline, NOINLINE)
|
||||
|
||||
AC_CACHE_CHECK([for RUBY_EXTERN], rb_cv_ruby_extern,
|
||||
[rb_cv_ruby_extern=no
|
||||
|
@ -595,6 +621,21 @@ AC_C_CHAR_UNSIGNED
|
|||
AC_C_INLINE
|
||||
AC_C_VOLATILE
|
||||
|
||||
if test x"$target_cpu" = xia64; then
|
||||
AC_LIBOBJ([ia64])
|
||||
AC_CACHE_CHECK(for __libc_ia64_register_backing_store_base,
|
||||
rb_cv___libc_ia64_register_backing_store_base,
|
||||
[rb_cv___libc_ia64_register_backing_store_base=no
|
||||
AC_TRY_LINK(
|
||||
[extern unsigned long __libc_ia64_register_backing_store_base;],
|
||||
[unsigned long p = __libc_ia64_register_backing_store_base;
|
||||
printf("%ld\n", p);],
|
||||
[rb_cv___libc_ia64_register_backing_store_base=yes])])
|
||||
if test $rb_cv___libc_ia64_register_backing_store_base = yes; then
|
||||
AC_DEFINE(HAVE___LIBC_IA64_REGISTER_BACKING_STORE_BASE)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether right shift preserve sign bit, rb_cv_rshift_sign,
|
||||
[AC_TRY_RUN([
|
||||
int
|
||||
|
@ -827,7 +868,7 @@ if test x"$enable_pthread" = xyes; then
|
|||
fi
|
||||
fi
|
||||
if test x"$ac_cv_header_ucontext_h" = xyes; then
|
||||
if test x"$target_cpu" = xia64 -o x"$rb_with_pthread" = xyes; then
|
||||
if x"$rb_with_pthread" = xyes; then
|
||||
AC_CHECK_FUNCS(getcontext setcontext)
|
||||
fi
|
||||
fi
|
||||
|
|
11
defines.h
11
defines.h
|
@ -221,13 +221,10 @@ flush_register_windows(void)
|
|||
;
|
||||
}
|
||||
# define FLUSH_REGISTER_WINDOWS flush_register_windows()
|
||||
#elif defined(__ia64__)
|
||||
void flush_register_windows(void)
|
||||
# if defined(__GNUC__) && (( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3)
|
||||
__attribute__ ((noinline))
|
||||
# endif
|
||||
;
|
||||
# define FLUSH_REGISTER_WINDOWS flush_register_windows()
|
||||
#elif defined(__ia64)
|
||||
void *rb_ia64_bsp(void);
|
||||
void rb_ia64_flushrs(void);
|
||||
# define FLUSH_REGISTER_WINDOWS rb_ia64_flushrs()
|
||||
#else
|
||||
# define FLUSH_REGISTER_WINDOWS ((void)0)
|
||||
#endif
|
||||
|
|
196
eval.c
196
eval.c
|
@ -195,7 +195,8 @@ static int volatile freebsd_clear_carry_flag = 0;
|
|||
# define POST_GETCONTEXT 0
|
||||
# endif
|
||||
# define ruby_longjmp(env, val) rb_jump_context(env, val)
|
||||
# define ruby_setjmp(j) ((j)->status = 0, \
|
||||
# define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \
|
||||
(just_before_setjmp), \
|
||||
PRE_GETCONTEXT, \
|
||||
getcontext(&(j)->context), \
|
||||
POST_GETCONTEXT, \
|
||||
|
@ -203,10 +204,12 @@ static int volatile freebsd_clear_carry_flag = 0;
|
|||
#else
|
||||
typedef jmp_buf rb_jmpbuf_t;
|
||||
# if !defined(setjmp) && defined(HAVE__SETJMP)
|
||||
# define ruby_setjmp(env) _setjmp(env)
|
||||
# define ruby_setjmp(just_before_setjmp, env) \
|
||||
((just_before_setjmp), _setjmp(env))
|
||||
# define ruby_longjmp(env,val) _longjmp(env,val)
|
||||
# else
|
||||
# define ruby_setjmp(env) setjmp(env)
|
||||
# define ruby_setjmp(just_before_setjmp, env) \
|
||||
((just_before_setjmp), setjmp(env))
|
||||
# define ruby_longjmp(env,val) longjmp(env,val)
|
||||
# endif
|
||||
#endif
|
||||
|
@ -1027,7 +1030,7 @@ static struct tag *prot_tag;
|
|||
#define PROT_LAMBDA INT2FIX(2) /* 5 */
|
||||
#define PROT_YIELD INT2FIX(3) /* 7 */
|
||||
|
||||
#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, ruby_setjmp(prot_tag->buf))
|
||||
#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, ruby_setjmp(((void)0), prot_tag->buf))
|
||||
|
||||
#define JUMP_TAG(st) do { \
|
||||
ruby_frame = prot_tag->frame; \
|
||||
|
@ -9680,19 +9683,6 @@ Init_Binding()
|
|||
rb_define_global_function("binding", rb_f_binding, 0);
|
||||
}
|
||||
|
||||
#ifdef __ia64__
|
||||
#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.
|
||||
*/
|
||||
#define __libc_ia64_register_backing_store_base (4ULL<<61)
|
||||
#else
|
||||
#pragma weak __libc_ia64_register_backing_store_base
|
||||
extern unsigned long __libc_ia64_register_backing_store_base;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Windows SEH refers data on the stack. */
|
||||
#undef SAVE_WIN32_EXCEPTION_LIST
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
|
@ -9796,9 +9786,11 @@ struct thread {
|
|||
long stk_max;
|
||||
VALUE *stk_ptr;
|
||||
VALUE *stk_pos;
|
||||
#ifdef __ia64__
|
||||
VALUE *bstr_ptr;
|
||||
#ifdef __ia64
|
||||
long bstr_len;
|
||||
long bstr_max;
|
||||
VALUE *bstr_ptr;
|
||||
VALUE *bstr_pos;
|
||||
#endif
|
||||
|
||||
struct FRAME *frame;
|
||||
|
@ -10052,9 +10044,9 @@ thread_mark(th)
|
|||
#if defined(THINK_C) || defined(__human68k__)
|
||||
rb_gc_mark_locations(th->stk_ptr+2, th->stk_ptr+th->stk_len+2);
|
||||
#endif
|
||||
#ifdef __ia64__
|
||||
#ifdef __ia64
|
||||
if (th->bstr_ptr) {
|
||||
rb_gc_mark_locations(th->bstr_ptr, th->bstr_ptr+th->bstr_len);
|
||||
rb_gc_mark_locations(th->bstr_ptr, th->bstr_ptr+th->bstr_len);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -10140,7 +10132,7 @@ thread_free(th)
|
|||
{
|
||||
if (th->stk_ptr) free(th->stk_ptr);
|
||||
th->stk_ptr = 0;
|
||||
#ifdef __ia64__
|
||||
#ifdef __ia64
|
||||
if (th->bstr_ptr) free(th->bstr_ptr);
|
||||
th->bstr_ptr = 0;
|
||||
#endif
|
||||
|
@ -10180,6 +10172,9 @@ static char *th_signm;
|
|||
#define RESTORE_EXIT 7
|
||||
|
||||
extern VALUE *rb_gc_stack_start;
|
||||
#ifdef __ia64
|
||||
extern VALUE *rb_gc_register_stack_start;
|
||||
#endif
|
||||
|
||||
static void
|
||||
rb_thread_save_context(th)
|
||||
|
@ -10201,22 +10196,19 @@ rb_thread_save_context(th)
|
|||
th->stk_len = len;
|
||||
FLUSH_REGISTER_WINDOWS;
|
||||
MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
|
||||
#ifdef __ia64__
|
||||
{
|
||||
ucontext_t ctx;
|
||||
VALUE *top, *bot;
|
||||
|
||||
getcontext(&ctx);
|
||||
bot = (VALUE*)__libc_ia64_register_backing_store_base;
|
||||
#if defined(__FreeBSD__)
|
||||
top = (VALUE*)ctx.uc_mcontext.mc_special.bspstore;
|
||||
#else
|
||||
top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
|
||||
#endif
|
||||
th->bstr_len = top - bot;
|
||||
REALLOC_N(th->bstr_ptr, VALUE, th->bstr_len);
|
||||
MEMCPY(th->bstr_ptr, (VALUE*)__libc_ia64_register_backing_store_base, VALUE, th->bstr_len);
|
||||
#ifdef __ia64
|
||||
th->bstr_pos = rb_gc_register_stack_start;
|
||||
len = (VALUE*)rb_ia64_bsp() - th->bstr_pos;
|
||||
th->bstr_len = 0;
|
||||
if (len > th->bstr_max) {
|
||||
VALUE *ptr = realloc(th->bstr_ptr, sizeof(VALUE) * len);
|
||||
if (!ptr) rb_memerror();
|
||||
th->bstr_ptr = ptr;
|
||||
th->bstr_max = len;
|
||||
}
|
||||
th->bstr_len = len;
|
||||
rb_ia64_flushrs();
|
||||
MEMCPY(th->bstr_ptr, th->bstr_pos, VALUE, th->bstr_len);
|
||||
#endif
|
||||
#ifdef SAVE_WIN32_EXCEPTION_LIST
|
||||
th->win32_exception_list = win32_get_exception_list();
|
||||
|
@ -10289,52 +10281,19 @@ rb_thread_switch(n)
|
|||
}
|
||||
|
||||
#define THREAD_SAVE_CONTEXT(th) \
|
||||
(rb_thread_save_context(th),\
|
||||
rb_thread_switch((FLUSH_REGISTER_WINDOWS, ruby_setjmp((th)->context))))
|
||||
(rb_thread_switch((FLUSH_REGISTER_WINDOWS, ruby_setjmp(rb_thread_save_context(th), (th)->context))))
|
||||
|
||||
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
__declspec(noinline) static void stack_extend(rb_thread_t, int);
|
||||
# endif
|
||||
static void
|
||||
stack_extend(th, exit)
|
||||
rb_thread_t th;
|
||||
int exit;
|
||||
{
|
||||
VALUE space[1024];
|
||||
|
||||
memset(space, 0, 1); /* prevent array from optimization */
|
||||
rb_thread_restore_context(th, exit);
|
||||
}
|
||||
NORETURN(NOINLINE(static void rb_thread_restore_context_0(rb_thread_t,int,void*)));
|
||||
NORETURN(NOINLINE(static void stack_extend(rb_thread_t, int, VALUE *)));
|
||||
|
||||
static void
|
||||
rb_thread_restore_context(th, exit)
|
||||
rb_thread_t th;
|
||||
int exit;
|
||||
rb_thread_restore_context_0(rb_thread_t th, int exit, void *vp)
|
||||
{
|
||||
VALUE v;
|
||||
static rb_thread_t tmp;
|
||||
static int ex;
|
||||
static VALUE tval;
|
||||
|
||||
if (!th->stk_ptr) rb_bug("unsaved context");
|
||||
|
||||
#if STACK_GROW_DIRECTION < 0
|
||||
if (&v > th->stk_pos) stack_extend(th, exit);
|
||||
#elif STACK_GROW_DIRECTION > 0
|
||||
if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
|
||||
#else
|
||||
if (&v < rb_gc_stack_start) {
|
||||
/* Stack grows downward */
|
||||
if (&v > th->stk_pos) stack_extend(th, exit);
|
||||
}
|
||||
else {
|
||||
/* Stack grows upward */
|
||||
if (&v < th->stk_pos + th->stk_len) stack_extend(th, exit);
|
||||
}
|
||||
#endif
|
||||
|
||||
rb_trap_immediate = 0; /* inhibit interrupts from here */
|
||||
ruby_frame = th->frame;
|
||||
ruby_scope = th->scope;
|
||||
|
@ -10360,8 +10319,8 @@ rb_thread_restore_context(th, exit)
|
|||
ex = exit;
|
||||
FLUSH_REGISTER_WINDOWS;
|
||||
MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len);
|
||||
#ifdef __ia64__
|
||||
MEMCPY((VALUE*)__libc_ia64_register_backing_store_base, tmp->bstr_ptr, VALUE, tmp->bstr_len);
|
||||
#ifdef __ia64
|
||||
MEMCPY(tmp->bstr_pos, tmp->bstr_ptr, VALUE, tmp->bstr_len);
|
||||
#endif
|
||||
|
||||
tval = rb_lastline_get();
|
||||
|
@ -10374,6 +10333,78 @@ rb_thread_restore_context(th, exit)
|
|||
ruby_longjmp(tmp->context, ex);
|
||||
}
|
||||
|
||||
#ifdef __ia64
|
||||
#define C(a) rse_##a##0, rse_##a##1, rse_##a##2, rse_##a##3, rse_##a##4
|
||||
#define E(a) rse_##a##0= rse_##a##1= rse_##a##2= rse_##a##3= rse_##a##4
|
||||
static volatile int C(a), C(b), C(c), C(d), C(e);
|
||||
static volatile int C(f), C(g), C(h), C(i), C(j);
|
||||
static volatile int C(k), C(l), C(m), C(n), C(o);
|
||||
static volatile int C(p), C(q), C(r), C(s), C(t);
|
||||
int rb_dummy_false = 0;
|
||||
NORETURN(NOINLINE(static void register_stack_extend(rb_thread_t, int, void *, VALUE *)));
|
||||
static void
|
||||
register_stack_extend(rb_thread_t th, int exit, void *vp, VALUE *curr_bsp)
|
||||
{
|
||||
if (rb_dummy_false) {
|
||||
/* use registers as much as possible */
|
||||
E(a) = E(b) = E(c) = E(d) = E(e) =
|
||||
E(f) = E(g) = E(h) = E(i) = E(j) =
|
||||
E(k) = E(l) = E(m) = E(n) = E(o) =
|
||||
E(p) = E(q) = E(r) = E(s) = E(t) = 0;
|
||||
E(a) = E(b) = E(c) = E(d) = E(e) =
|
||||
E(f) = E(g) = E(h) = E(i) = E(j) =
|
||||
E(k) = E(l) = E(m) = E(n) = E(o) =
|
||||
E(p) = E(q) = E(r) = E(s) = E(t) = 0;
|
||||
}
|
||||
if (curr_bsp < th->bstr_pos+th->bstr_len) {
|
||||
register_stack_extend(th, exit, &exit, (VALUE*)rb_ia64_bsp());
|
||||
}
|
||||
rb_thread_restore_context_0(th, exit, &exit);
|
||||
}
|
||||
#undef C
|
||||
#undef E
|
||||
#endif
|
||||
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
__declspec(noinline) static void stack_extend(rb_thread_t, int);
|
||||
# endif
|
||||
static void
|
||||
stack_extend(rb_thread_t th, int exit, VALUE *addr_in_prev_frame)
|
||||
{
|
||||
#define STACK_PAD_SIZE 1024
|
||||
VALUE space[STACK_PAD_SIZE];
|
||||
|
||||
#if STACK_GROW_DIRECTION < 0
|
||||
if (addr_in_prev_frame > th->stk_pos) stack_extend(th, exit, &space[0]);
|
||||
#elif STACK_GROW_DIRECTION > 0
|
||||
if (addr_in_prev_frame < th->stk_pos + th->stk_len) stack_extend(th, exit, &space[STACK_PAD_SIZE-1]);
|
||||
#else
|
||||
if (addr_in_prev_frame < rb_gc_stack_start) {
|
||||
/* Stack grows downward */
|
||||
if (addr_in_prev_frame > th->stk_pos) stack_extend(th, exit, &space[0]);
|
||||
}
|
||||
else {
|
||||
/* Stack grows upward */
|
||||
if (addr_in_prev_frame < th->stk_pos + th->stk_len) stack_extend(th, exit, &space[STACK_PAD_SIZE-1]);
|
||||
}
|
||||
#endif
|
||||
#ifdef __ia64
|
||||
register_stack_extend(th, exit, space, (VALUE*)rb_ia64_bsp());
|
||||
#else
|
||||
rb_thread_restore_context_0(th, exit, space);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
rb_thread_restore_context(th, exit)
|
||||
rb_thread_t th;
|
||||
int exit;
|
||||
{
|
||||
VALUE v;
|
||||
if (!th->stk_ptr) rb_bug("unsaved context");
|
||||
stack_extend(th, exit, &v);
|
||||
}
|
||||
|
||||
static void
|
||||
rb_thread_ready(th)
|
||||
rb_thread_t th;
|
||||
|
@ -11579,7 +11610,7 @@ rb_thread_group(thread)
|
|||
return group;
|
||||
}
|
||||
|
||||
#ifdef __ia64__
|
||||
#ifdef __ia64
|
||||
# define IA64_INIT(x) x
|
||||
#else
|
||||
# define IA64_INIT(x)
|
||||
|
@ -11601,6 +11632,7 @@ rb_thread_group(thread)
|
|||
th->wait_for = 0;\
|
||||
IA64_INIT(th->bstr_ptr = 0);\
|
||||
IA64_INIT(th->bstr_len = 0);\
|
||||
IA64_INIT(th->bstr_max = 0);\
|
||||
FD_ZERO(&th->readfds);\
|
||||
FD_ZERO(&th->writefds);\
|
||||
FD_ZERO(&th->exceptfds);\
|
||||
|
@ -13054,13 +13086,3 @@ rb_throw(tag, val)
|
|||
argv[1] = val;
|
||||
rb_f_throw(2, argv);
|
||||
}
|
||||
|
||||
/* flush_register_windows must not be inlined because flushrs doesn't flush
|
||||
* current frame in register stack. */
|
||||
#ifdef __ia64__
|
||||
void flush_register_windows(void)
|
||||
{
|
||||
__asm__ ("flushrs");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
95
gc.c
95
gc.c
|
@ -30,20 +30,6 @@
|
|||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef __ia64__
|
||||
#include <ucontext.h>
|
||||
#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.
|
||||
*/
|
||||
#define __libc_ia64_register_backing_store_base (4ULL<<61)
|
||||
#else
|
||||
#pragma weak __libc_ia64_register_backing_store_base
|
||||
extern unsigned long __libc_ia64_register_backing_store_base;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
@ -423,6 +409,9 @@ rb_data_object_alloc(klass, datap, dmark, dfree)
|
|||
|
||||
extern st_table *rb_class_tbl;
|
||||
VALUE *rb_gc_stack_start = 0;
|
||||
#ifdef __ia64
|
||||
VALUE *rb_gc_register_stack_start = 0;
|
||||
#endif
|
||||
|
||||
#ifdef DJGPP
|
||||
/* set stack size (http://www.delorie.com/djgpp/v2faq/faq15_9.html) */
|
||||
|
@ -445,7 +434,7 @@ static unsigned int STACK_LEVEL_MAX = 655300;
|
|||
# define SET_STACK_END VALUE stack_end; alloca(0);
|
||||
# define STACK_END (&stack_end)
|
||||
#else
|
||||
# if defined(__GNUC__) && defined(USE_BUILTIN_FRAME_ADDRESS) && !defined(__ia64__)
|
||||
# if defined(__GNUC__) && defined(USE_BUILTIN_FRAME_ADDRESS) && !defined(__ia64)
|
||||
# if ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 ) || __GNUC__ > 3
|
||||
__attribute__ ((noinline))
|
||||
# endif
|
||||
|
@ -1385,23 +1374,10 @@ garbage_collect()
|
|||
else
|
||||
rb_gc_mark_locations(rb_gc_stack_start, (VALUE*)STACK_END + 1);
|
||||
#endif
|
||||
#ifdef __ia64__
|
||||
#ifdef __ia64
|
||||
/* mark backing store (flushed register window on the stack) */
|
||||
/* the basic idea from guile GC code */
|
||||
{
|
||||
ucontext_t ctx;
|
||||
VALUE *top, *bot;
|
||||
getcontext(&ctx);
|
||||
mark_locations_array((VALUE*)&ctx.uc_mcontext,
|
||||
((size_t)(sizeof(VALUE)-1 + sizeof ctx.uc_mcontext)/sizeof(VALUE)));
|
||||
bot = (VALUE*)__libc_ia64_register_backing_store_base;
|
||||
#if defined(__FreeBSD__)
|
||||
top = (VALUE*)ctx.uc_mcontext.mc_special.bspstore;
|
||||
#else
|
||||
top = (VALUE*)ctx.uc_mcontext.sc_ar_bsp;
|
||||
#endif
|
||||
rb_gc_mark_locations(bot, top);
|
||||
}
|
||||
rb_gc_mark_locations(rb_gc_register_stack_start, (VALUE*)rb_ia64_bsp());
|
||||
#endif
|
||||
#if defined(__human68k__) || defined(__mc68000__)
|
||||
rb_gc_mark_locations((VALUE*)((char*)STACK_END + 2),
|
||||
|
@ -1477,6 +1453,28 @@ 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));
|
||||
|
@ -1485,8 +1483,10 @@ Init_stack(addr)
|
|||
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;
|
||||
{
|
||||
extern void *STACK_END_ADDRESS;
|
||||
rb_gc_stack_start = STACK_END_ADDRESS;
|
||||
}
|
||||
#else
|
||||
if (!addr) addr = (VALUE *)&addr;
|
||||
STACK_UPPER(&addr, addr, ++addr);
|
||||
|
@ -1513,6 +1513,37 @@ Init_stack(addr)
|
|||
#endif
|
||||
}
|
||||
|
||||
void ruby_init_stack(VALUE *addr
|
||||
#ifdef __ia64
|
||||
, void *bsp
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (!rb_gc_stack_start ||
|
||||
STACK_UPPER(&addr,
|
||||
rb_gc_stack_start > addr,
|
||||
rb_gc_stack_start < addr)) {
|
||||
rb_gc_stack_start = addr;
|
||||
}
|
||||
#ifdef __ia64
|
||||
if (!rb_gc_register_stack_start ||
|
||||
(VALUE*)bsp < rb_gc_register_stack_start) {
|
||||
rb_gc_register_stack_start = (VALUE*)bsp;
|
||||
}
|
||||
#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
|
||||
}
|
||||
|
||||
/*
|
||||
* Document-class: ObjectSpace
|
||||
|
|
9
main.c
9
main.c
|
@ -41,8 +41,11 @@ main(argc, argv, envp)
|
|||
argc = ccommand(&argv);
|
||||
#endif
|
||||
|
||||
ruby_init();
|
||||
ruby_options(argc, argv);
|
||||
ruby_run();
|
||||
{
|
||||
RUBY_INIT_STACK
|
||||
ruby_init();
|
||||
ruby_options(argc, argv);
|
||||
ruby_run();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2042,6 +2042,10 @@ fix_mul(x, y)
|
|||
VALUE x, y;
|
||||
{
|
||||
if (FIXNUM_P(y)) {
|
||||
#ifdef __HP_cc
|
||||
/* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */
|
||||
volatile
|
||||
#endif
|
||||
long a, b, c;
|
||||
VALUE r;
|
||||
|
||||
|
|
25
ruby.h
25
ruby.h
|
@ -25,6 +25,15 @@ extern "C" {
|
|||
#ifdef RUBY_EXTCONF_H
|
||||
#include RUBY_EXTCONF_H
|
||||
#endif
|
||||
|
||||
#define NORETURN_STYLE_NEW 1
|
||||
#ifndef NORETURN
|
||||
# define NORETURN(x) x
|
||||
#endif
|
||||
#ifndef NOINLINE
|
||||
# define NOINLINE(x) x
|
||||
#endif
|
||||
|
||||
#include "defines.h"
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
|
@ -58,11 +67,6 @@ extern "C" {
|
|||
#define ISXDIGIT(c) (ISASCII(c) && isxdigit((int)(unsigned char)(c)))
|
||||
#endif
|
||||
|
||||
#define NORETURN_STYLE_NEW 1
|
||||
#ifndef NORETURN
|
||||
# define NORETURN(x) x
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ALLOCA_H)
|
||||
#include <alloca.h>
|
||||
#else
|
||||
|
@ -565,6 +569,17 @@ NORETURN(void rb_throw _((const char*,VALUE)));
|
|||
|
||||
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());
|
||||
#else
|
||||
void ruby_init_stack(VALUE*);
|
||||
#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
Add a link
Reference in a new issue