ruby-changes:21708
From: ngoto <ko1@a...>
Date: Tue, 15 Nov 2011 13:42:44 +0900 (JST)
Subject: [ruby-changes:21708] ngoto:r33757 (trunk): * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code
ngoto 2011-11-15 13:42:31 +0900 (Tue, 15 Nov 2011) New Revision: 33757 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33757 Log: * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code to a separete file sparc.c for preventing inlining optimization. Patched by Jurij Smakov. [Bug #5244] [ruby-core:40685] * sparc.c (rb_sparc_flush_register_windows): ditto. * configure.in: ditto. Added files: trunk/sparc.c Modified files: trunk/ChangeLog trunk/configure.in trunk/include/ruby/defines.h Index: include/ruby/defines.h =================================================================== --- include/ruby/defines.h (revision 33756) +++ include/ruby/defines.h (revision 33757) @@ -198,21 +198,8 @@ #endif #if defined(__sparc) -static inline void -flush_register_windows(void) -{ - asm -#ifdef __GNUC__ - volatile -#endif -# if SIZEOF_VOIDP > 4 /* workaround for Debian Sparc quirk */ - ("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(); +# define FLUSH_REGISTER_WINDOWS rb_sparc_flush_register_windows() #elif defined(__ia64) void *rb_ia64_bsp(void); void rb_ia64_flushrs(void); Index: configure.in =================================================================== --- configure.in (revision 33756) +++ configure.in (revision 33757) @@ -1087,7 +1087,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 Index: ChangeLog =================================================================== --- ChangeLog (revision 33756) +++ ChangeLog (revision 33757) @@ -1,3 +1,11 @@ +Tue Nov 15 13:38:14 2011 Naohisa Goto <ngotogenome@g...> + + * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code + to a separete file sparc.c for preventing inlining optimization. + Patched by Jurij Smakov. [Bug #5244] [ruby-core:40685] + * sparc.c (rb_sparc_flush_register_windows): ditto. + * configure.in: ditto. + Tue Nov 15 13:11:35 2011 KOSAKI Motohiro <kosaki.motohiro@g...> * include/ruby/ruby.h: get rid of gcc specific rb_long2int(), Index: sparc.c =================================================================== --- sparc.c (revision 0) +++ sparc.c (revision 33757) @@ -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() +{ + 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 + ; +} -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/