From 09590a73fab0000777c16e9f97dba31bb3c7126e Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 11 Aug 2003 18:18:40 +0000 Subject: * eval.c (THREAD_SAVE_CONTEXT): should explicitly turn off the flag before calling getcontext(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 2cc11759b6..2317c8bf95 100644 --- a/eval.c +++ b/eval.c @@ -7840,7 +7840,12 @@ enum thread_status { struct thread { struct thread *next, *prev; +#ifdef __ia64__ + ucontext_t context; + int context_status; +#else jmp_buf context; +#endif #ifdef SAVE_WIN32_EXCEPTION_LIST DWORD win32_exception_list; #endif @@ -8216,7 +8221,7 @@ rb_thread_save_context(th) #endif th->bstr_len = top - bot; REALLOC_N(th->bstr_ptr, VALUE, th->bstr_len); - MEMCPY(th->bstr_ptr, __libc_ia64_register_backing_store_base, VALUE, th->bstr_len); + MEMCPY(th->bstr_ptr, (VALUE*)__libc_ia64_register_backing_store_base, VALUE, th->bstr_len); } #endif #ifdef SAVE_WIN32_EXCEPTION_LIST @@ -8280,9 +8285,16 @@ rb_thread_switch(n) return 1; } -#define THREAD_SAVE_CONTEXT(th) \ +#ifdef __ia64__ +# define THREAD_SAVE_CONTEXT(th) \ + (rb_thread_save_context(th),\ + th->context_status = 0,\ + rb_thread_switch((FLUSH_REGISTER_WINDOWS, getcontext(&th->context),(th)->context_status))) +#else +# define THREAD_SAVE_CONTEXT(th) \ (rb_thread_save_context(th),\ rb_thread_switch((FLUSH_REGISTER_WINDOWS, setjmp((th)->context)))) +#endif static void rb_thread_restore_context _((rb_thread_t,int)); @@ -8360,7 +8372,12 @@ rb_thread_restore_context(th, exit) rb_backref_set(tmp->last_match); tmp->last_match = tval; +#ifdef __ia64__ + tmp->context_status = ex; + setcontext(&tmp->context); +#else longjmp(tmp->context, ex); +#endif } static void -- cgit v1.2.3