From 09590a73fab0000777c16e9f97dba31bb3c7126e Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 11 Aug 2003 18:18:40 +0000 Subject: [PATCH] * 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 --- ChangeLog | 3 +++ eval.c | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f51ec9ad78..985bdbd846 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Tue Aug 12 02:48:56 2003 Yukihiro Matsumoto + * eval.c (THREAD_SAVE_CONTEXT): should explicitly turn off the + flag before calling getcontext(2). + * eval.c (struct thread): add member to save backing store on IA64. (ruby-bugs PR1086) 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