aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2006-01-24 22:38:33 +0800
committerume <ume@FreeBSD.org>2006-01-24 22:38:33 +0800
commit7563282d1ebabbe5253527e4e5a485740dad3f61 (patch)
tree31def196a5284bf6efc46fecba3faca7bed83a79 /lang
parent3d281630948a7644c9467be6a8cacc418e438430 (diff)
downloadfreebsd-ports-gnome-7563282d1ebabbe5253527e4e5a485740dad3f61.tar.gz
freebsd-ports-gnome-7563282d1ebabbe5253527e4e5a485740dad3f61.tar.zst
freebsd-ports-gnome-7563282d1ebabbe5253527e4e5a485740dad3f61.zip
Use the code actually committed into Ruby CVS against
getcontext/setcontext issue. Obtained from: Ruby CVS
Diffstat (limited to 'lang')
-rw-r--r--lang/ruby18/Makefile2
-rw-r--r--lang/ruby18/files/patch-eval.c139
2 files changed, 99 insertions, 42 deletions
diff --git a/lang/ruby18/Makefile b/lang/ruby18/Makefile
index 17929f5f0755..dba404c17e5c 100644
--- a/lang/ruby18/Makefile
+++ b/lang/ruby18/Makefile
@@ -7,7 +7,7 @@
PORTNAME= ruby
PORTVERSION= ${RUBY_PORTVERSION}
-PORTREVISION= 3
+PORTREVISION= 4
PORTEPOCH= 1
CATEGORIES= lang ruby ipv6
MASTER_SITES= ${MASTER_SITE_RUBY}
diff --git a/lang/ruby18/files/patch-eval.c b/lang/ruby18/files/patch-eval.c
index 72fc25e22608..8f4b1f242009 100644
--- a/lang/ruby18/files/patch-eval.c
+++ b/lang/ruby18/files/patch-eval.c
@@ -1,8 +1,17 @@
Index: eval.c
diff -u -p eval.c.orig eval.c
--- eval.c.orig Tue Dec 20 22:41:47 2005
-+++ eval.c Sun Jan 22 13:59:48 2006
-@@ -129,32 +129,64 @@ rb_jump_context(env, val)
++++ eval.c Mon Jan 23 10:01:51 2006
+@@ -108,7 +108,7 @@ rb_jump_context(env, val)
+ abort(); /* ensure noreturn */
+ }
+ /*
+- * FUNCTION_CALL_MAY_RETURN_TWICE is a magic for getcontext, gcc,
++ * PRE_GETCONTEXT and POST_GETCONTEXT is a magic for getcontext, gcc,
+ * IA64 register stack and SPARC register window combination problem.
+ *
+ * Assume following code sequence.
+@@ -129,42 +129,88 @@ rb_jump_context(env, val)
* But it has not the problem because gcc knows setjmp may return twice.
* gcc detects setjmp and generates setjmp safe code.
*
@@ -15,58 +24,106 @@ diff -u -p eval.c.orig eval.c
*
* Since the magic setjmp is not enough for SPARC,
* inline asm is used to prohibit registers in register windows.
+- */
+-#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
+-#define FUNCTION_CALL_MAY_RETURN_TWICE \
+- ({ __asm__ volatile ("" : : : \
+- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
+- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
+- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
+-#else
+ *
+ * Since the problem is fixed at gcc 4.0.3, the magic is applied only for
+ * prior versions of gcc.
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21957
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22127
+ */
-+#define GCC_VERSION_BEFORE(major, minor, patchlevel) \
++# define GCC_VERSION_BEFORE(major, minor, patchlevel) \
+ (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
+ ((__GNUC__ < (major)) || \
+ (__GNUC__ == (major) && __GNUC_MINOR__ < (minor)) || \
+ (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ < (patchlevel))))
-+#if GCC_VERSION_BEFORE(4,0,3)
-+#if defined(sparc) || defined(__sparc__)
-+#ifdef __pic__
++# if GCC_VERSION_BEFORE(4,0,3) && (defined(sparc) || defined(__sparc__))
++# ifdef __pic__
+/*
+ * %l7 is excluded for PIC because it is PIC register.
+ * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
- */
--#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
- #define FUNCTION_CALL_MAY_RETURN_TWICE \
- ({ __asm__ volatile ("" : : : \
- "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
-+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
- "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
- #else
-+#define FUNCTION_CALL_MAY_RETURN_TWICE \
-+ ({ __asm__ volatile ("" : : : \
-+ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
-+ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-+#endif
-+#elif defined(__ia64)
++ */
++# define PRE_GETCONTEXT \
++ ({ __asm__ volatile ("" : : : \
++ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
++ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
++# else
++# define PRE_GETCONTEXT \
++ ({ __asm__ volatile ("" : : : \
++ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
++ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
++# endif
++# define POST_GETCONTEXT PRE_GETCONTEXT
++# elif GCC_VERSION_BEFORE(4,0,3) && defined(__ia64)
static jmp_buf function_call_may_return_twice_jmp_buf;
- int function_call_may_return_twice_false = 0;
- #define FUNCTION_CALL_MAY_RETURN_TWICE \
- (function_call_may_return_twice_false ? \
- setjmp(function_call_may_return_twice_jmp_buf) : \
- 0)
-+#else
-+#define FUNCTION_CALL_MAY_RETURN_TWICE 0
-+#endif
-+#else
-+#define FUNCTION_CALL_MAY_RETURN_TWICE 0
- #endif
- #define ruby_longjmp(env, val) rb_jump_context(env, val)
-+static volatile int freebsd_clear_carry_flag = 0;
- #define ruby_setjmp(j) ((j)->status = 0, \
- FUNCTION_CALL_MAY_RETURN_TWICE, \
-+ freebsd_clear_carry_flag = freebsd_clear_carry_flag + freebsd_clear_carry_flag, \
- getcontext(&(j)->context), \
-+ FUNCTION_CALL_MAY_RETURN_TWICE, \
- (j)->status)
+-int function_call_may_return_twice_false = 0;
+-#define FUNCTION_CALL_MAY_RETURN_TWICE \
+- (function_call_may_return_twice_false ? \
+- setjmp(function_call_may_return_twice_jmp_buf) : \
+- 0)
+-#endif
+-#define ruby_longjmp(env, val) rb_jump_context(env, val)
+-#define ruby_setjmp(j) ((j)->status = 0, \
+- FUNCTION_CALL_MAY_RETURN_TWICE, \
+- getcontext(&(j)->context), \
+- (j)->status)
++int function_call_may_return_twice_false_1 = 0;
++int function_call_may_return_twice_false_2 = 0;
++# define PRE_GETCONTEXT \
++ (function_call_may_return_twice_false_1 ? \
++ setjmp(function_call_may_return_twice_jmp_buf) : \
++ 0)
++# define POST_GETCONTEXT \
++ (function_call_may_return_twice_false_2 ? \
++ setjmp(function_call_may_return_twice_jmp_buf) : \
++ 0)
++# elif defined(__FreeBSD__)
++/*
++ * workaround for FreeBSD/i386 getcontext/setcontext bug.
++ * clear the carry flag by (0 ? ... : ...).
++ * FreeBSD PR 92110 http://www.freebsd.org/cgi/query-pr.cgi?pr=92110
++ * [ruby-dev:28263]
++ */
++static int volatile freebsd_clear_carry_flag = 0;
++# define PRE_GETCONTEXT \
++ (freebsd_clear_carry_flag ? (freebsd_clear_carry_flag = 0) : 0)
++# endif
++# ifndef PRE_GETCONTEXT
++# define PRE_GETCONTEXT 0
++# endif
++# ifndef POST_GETCONTEXT
++# define POST_GETCONTEXT 0
++# endif
++# define ruby_longjmp(env, val) rb_jump_context(env, val)
++# define ruby_setjmp(j) ((j)->status = 0, \
++ PRE_GETCONTEXT, \
++ getcontext(&(j)->context), \
++ POST_GETCONTEXT, \
++ (j)->status)
#else
typedef jmp_buf rb_jmpbuf_t;
+-#if !defined(setjmp) && defined(HAVE__SETJMP)
+-#define ruby_setjmp(env) _setjmp(env)
+-#define ruby_longjmp(env,val) _longjmp(env,val)
+-#else
+-#define ruby_setjmp(env) setjmp(env)
+-#define ruby_longjmp(env,val) longjmp(env,val)
+-#endif
++# if !defined(setjmp) && defined(HAVE__SETJMP)
++# define ruby_setjmp(env) _setjmp(env)
++# define ruby_longjmp(env,val) _longjmp(env,val)
++# else
++# define ruby_setjmp(env) setjmp(env)
++# define ruby_longjmp(env,val) longjmp(env,val)
++# endif
+ #endif
+
+ #include <sys/types.h>