From bfabc05a4375b84fa128af89337b1195248bd6da Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 21 Sep 2004 03:08:33 +0000 Subject: * enum.c (enum_sort_by): do not use qsort directly. use rb_ary_sort_bang() instead. [ruby-dev:24291] * enum.c (enum_sort_by): pedantic type check added. [ruby-dev:24291] * hash.c (rb_hash_foreach_iter): check iter_lev after each iteration. [ruby-dev:24289] * array.c (rb_ary_and): element size might change during comparison. [ruby-dev:24290] * array.c (rb_ary_or): ditto. [ruby-dev:24292] * array.c (rb_ary_equal): wrong fix. [ruby-dev:24286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index d4b9589b20..6ab9f5e6aa 100644 --- a/eval.c +++ b/eval.c @@ -9316,10 +9316,14 @@ Init_Binding() */ #define __libc_ia64_register_backing_store_base (4ULL<<61) #else +#ifdef HAVE_UNWIND_H +#include +#else #pragma weak __libc_ia64_register_backing_store_base extern unsigned long __libc_ia64_register_backing_store_base; #endif #endif +#endif /* Windows SEH refers data on the stack. */ #undef SAVE_WIN32_EXCEPTION_LIST @@ -9779,19 +9783,24 @@ rb_thread_save_context(th) MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len); #ifdef __ia64__ { - ucontext_t ctx; VALUE *top, *bot; +#ifdef HAVE_UNWIND_H + _Unwind_Context *unwctx = _UNW_createContextForSelf(); + + _UNW_currentContext(unwctx); + bot = (VALUE*)(long)_UNW_getAR(unwctx, _UNW_AR_BSP); + top = (VALUE*)(long)_UNW_getAR(unwctx, _UNW_AR_BSPSTORE); + _UNW_destroyContext(unwctx); +#else + ucontext_t ctx; 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; + top = (VALUE*)ctx.uc_mcontext.IA64_BSPSTORE; #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); + MEMCPY(th->bstr_ptr, bot, VALUE, th->bstr_len); } #endif #ifdef SAVE_WIN32_EXCEPTION_LIST @@ -9934,7 +9943,19 @@ rb_thread_restore_context(th, 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); + { + VALUE *base; +#ifdef HAVE_UNWIND_H + _Unwind_Context *unwctx = _UNW_createContextForSelf(); + + _UNW_currentContext(unwctx); + base = (VALUE*)(long)_UNW_getAR(unwctx, _UNW_AR_BSP); + _UNW_destroyContext(unwctx); +#else + base = (VALUE*)__libc_ia64_register_backing_store_base; +#endif + MEMCPY(base, tmp->bstr_ptr, VALUE, tmp->bstr_len); + } #endif tval = rb_lastline_get(); -- cgit v1.2.3