summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-04 18:48:24 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-04 18:48:24 +0000
commit50e62191ecf65a7118041447da8e629b2ff62e7a (patch)
treed4c4bf1801116dffb61ad9f214dc0f83c42cace6
parentb369eea79f5ef06a8b314e5ef3a25a0db36db410 (diff)
* 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) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--defines.h17
-rw-r--r--eval.c5
-rw-r--r--gc.c2
4 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ba8f15..43431c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sun Jan 5 03:43:47 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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 <usa@ruby-lang.org>
* file.c (utimbuf): use utimbuf instead of _utimbuf if defined _WIN32.
diff --git a/defines.h b/defines.h
index cb488d7..0d115a4 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 9030b70..fcf3643 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 f2ea3cc..e47d943 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\