[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ruby1.9.1 migration to testing



On Thu, Nov 03, 2011 at 06:31:45AM +0100, Lucas Nussbaum wrote:
> On 03/11/11 at 00:45 +0000, Jurij Smakov wrote:
> > > > [sparc] continuations are completely broken.
> > > > See http://redmine.ruby-lang.org/issues/5244 (minimal test case
> > > > included)
> > > 
> > > Much progress on that, thanks to Jurij Smakov who also took it to the
> > > sparclinux list (thread at
> > > http://thread.gmane.org/gmane.linux.ports.sparc/15364).
> > > A partial fix has been commited upstream. I'm waiting for a final
> > > decision to backport it.
> > 
> > FWIW, I've posted a patch which implements what I consider a proper 
> > fix for this issue to the upstream bug. Since it's already closed and 
> > Ruby bug tracker does not allow mere mortals to reopen, I'm not 
> > even certain whether any of the upstream maintainers will notice it.
> 
> Thanks a lot! I will monitor the bug and make sure it ends up in Ruby
> upstream and in the Debian package.

Lucas, please see the attached patches. The first one is a backport of
Ruby upstream commits r33757 and r33758 fixing the continuations 
issue, which applies cleanly to Debian's ruby1.9.1-1.9.3.0-1. The 
second patch turns off -fno-tree-sra hack (the problem is fixed in 
gcc-4.6 4.6.2-6, which made it to unstable yesterday) and re-enables 
the test suite for Debian on sparc. I've just confirmed that with 
these patches applied ruby1.9.1-1.9.3.0-1 Debian package 
successfully builds and the test suite passes. Note that the first 
patch requires regenerating the configure script.

That renders bugs #593138 and #545345 obsolete, at least for unstable. 

Best regards, 
-- 
Jurij Smakov                                           jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
diff -aurN a/configure.in b/configure.in
--- a/configure.in	2011-12-10 08:59:53.000000000 +0000
+++ b/configure.in	2011-12-10 09:09:19.244000008 +0000
@@ -1133,7 +1133,8 @@
 			[CFLAGS="-mieee $CFLAGS"],
 		[osf*],    # ccc
 			[CFLAGS="-ieee $CFLAGS"],
-		)])
+		)],
+[sparc*], [AC_LIBOBJ([sparc])])
 
 ac_cv_header_net_socket_h=${ac_cv_header_net_socket_h=no}
 if test "$ac_cv_header_net_socket_h" = yes; then
diff -aurN a/include/ruby/defines.h b/include/ruby/defines.h
--- a/include/ruby/defines.h	2011-06-06 07:11:37.000000000 +0100
+++ b/include/ruby/defines.h	2011-12-10 09:12:35.472002372 +0000
@@ -268,21 +268,8 @@
 #endif
 
 #if defined(sparc) || defined(__sparc__)
-static inline void
-flush_register_windows(void)
-{
-    asm
-#ifdef __GNUC__
-	volatile
-#endif
-# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
-	("flushw")
-# else
-	("ta 0x03")
-# endif /* trap always to flush register windows if we are on a Sparc system */
-	;
-}
-#  define FLUSH_REGISTER_WINDOWS flush_register_windows()
+void rb_sparc_flush_register_windows(void);
+#  define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows()
 #elif defined(__ia64)
 void *rb_ia64_bsp(void);
 void rb_ia64_flushrs(void);
diff -aurN a/sparc.c b/sparc.c
--- a/sparc.c	1970-01-01 01:00:00.000000000 +0100
+++ b/sparc.c	2011-12-10 09:12:50.155998557 +0000
@@ -0,0 +1,30 @@
+/********************************************************************
+ Flush register windows on sparc.
+
+ This function is in a separate file to prevent inlining. The "flushw"
+ assembler instruction used on sparcv9 flushes all register windows
+ except the current one, so if it is inlined, the current register
+ window of the process executing the instruction will not be flushed
+ correctly.
+
+ See http://redmine.ruby-lang.org/issues/5244 for discussion.
+*********************************************************************/
+void rb_sparc_flush_register_windows(void)
+{
+    asm
+#ifdef __GNUC__
+    __volatile__
+#endif
+
+/* This condition should be in sync with one in configure.in */
+#if defined(__sparcv9) || defined(__sparc_v9__) || defined(__arch64__)
+# ifdef __GNUC__
+    ("flushw" : : : "%o7")
+# else
+    ("flushw")
+# endif /* __GNUC__ */
+#else
+    ("ta 0x03")
+#endif
+    ;
+}
--- a/debian/rules	2011-10-31 07:38:05.000000000 +0000
+++ b/debian/rules	2011-12-10 09:15:42.652004446 +0000
@@ -39,7 +39,7 @@
 else
 	CFLAGS += -g -O2
 # Workaround for #634260 (ruby1.8). Can be removed when #635126 is fixed.
-ifneq (,$(filter $(DEB_BUILD_ARCH),armel sparc))
+ifneq (,$(filter $(DEB_BUILD_ARCH),armel))
 	CFLAGS += -fno-tree-sra
 endif
 endif
@@ -135,7 +135,7 @@
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
 # Disable test suites on some broken architectures.
 # See http://lists.debian.org/debian-release/2011/10/msg00279.html
-ifeq (,$(filter $(DEB_BUILD_ARCH),ia64 sparc kfreebsd-i386 kfreebsd-amd64))
+ifeq (,$(filter $(DEB_BUILD_ARCH),ia64 kfreebsd-i386 kfreebsd-amd64))
 	debian/run-test-suites.bash
 endif
 endif

Reply to: