diff --git a/ChangeLog b/ChangeLog index 8ba8f15c63..43431c921d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun Jan 5 03:43:47 2003 Akinori MUSHA + + * defines.h (FLUSH_REGISTER_WINDOWS): Make the flushw call an + inline function instead so it can be used as an expression. + + * eval.c (EXEC_TAG, THREAD_SAVE_CONTEXT): Consistently call + FLUSH_REGISTER_WINDOWS before calling setjmp(). (I suspect that + every setjmp() implementation should take care of register + windows, though) + Sun Jan 5 03:12:32 2003 NAKAMURA Usaku * file.c (utimbuf): use utimbuf instead of _utimbuf if defined _WIN32. diff --git a/defines.h b/defines.h index cb488d7bf7..0d115a45e9 100644 --- a/defines.h +++ b/defines.h @@ -138,15 +138,20 @@ void xfree _((void*)); #endif #if defined(sparc) || defined(__sparc__) -# if defined(linux) || defined(__linux__) -#define FLUSH_REGISTER_WINDOWS asm("ta 0x83") -# elif defined(__FreeBSD__) && defined(__sparc64__) -#define FLUSH_REGISTER_WINDOWS asm volatile("flushw" : :) +static inline void +flush_register_windows(void) +{ +# if defined(__sparc_v9__) || defined(__arch64__) + asm volatile ("flushw" : :); +# elif defined(linux) || defined(__linux__) + asm volatile ("ta 0x83"); # else /* Solaris, OpenBSD, NetBSD, etc. */ -#define FLUSH_REGISTER_WINDOWS asm("ta 0x03") + asm volatile ("ta 0x03"); # endif /* trap always to flush register windows if we are on a Sparc system */ +} +#define FLUSH_REGISTER_WINDOWS flush_register_windows() #else /* Not a sparc, so */ -#define FLUSH_REGISTER_WINDOWS /* empty -- nothing to do here */ +#define FLUSH_REGISTER_WINDOWS /* empty -- nothing to do here */ #endif #if defined(DOSISH) diff --git a/eval.c b/eval.c index 9030b70418..fcf3643504 100644 --- a/eval.c +++ b/eval.c @@ -825,7 +825,7 @@ static struct tag *prot_tag; #define PROT_FUNC -1 #define PROT_THREAD -2 -#define EXEC_TAG() setjmp(prot_tag->buf) +#define EXEC_TAG() (FLUSH_REGISTER_WINDOWS, setjmp(prot_tag->buf)) #define JUMP_TAG(st) do { \ ruby_frame = prot_tag->frame; \ @@ -7753,7 +7753,8 @@ thread_switch(n) } #define THREAD_SAVE_CONTEXT(th) \ - (rb_thread_save_context(th),thread_switch(setjmp((th)->context))) + (rb_thread_save_context(th),\ + thread_switch((FLUSH_REGISTER_WINDOWS, setjmp((th)->context)))) static void rb_thread_restore_context _((rb_thread_t,int)); diff --git a/gc.c b/gc.c index f2ea3cc37a..e47d943d4e 100644 --- a/gc.c +++ b/gc.c @@ -374,7 +374,7 @@ static unsigned int STACK_LEVEL_MAX = 655300; # endif # define STACK_END (stack_end) #endif -#ifdef __sparc__ +#if defined(sparc) || defined(__sparc__) # define STACK_LENGTH (rb_gc_stack_start - STACK_END + 0x80) #else # define STACK_LENGTH ((STACK_END < rb_gc_stack_start) ? rb_gc_stack_start - STACK_END\