Project

General

Profile

Bug #5244 ยป flush_windows.patch

jurij (Jurij Smakov), 11/03/2011 07:58 AM

View differences:

configure.in 2011-10-30 15:51:33.000000000 +0000 โ†’ configure.in 2011-11-02 20:09:13.000000000 +0000
1082 1082
			[CFLAGS="-mieee $CFLAGS"],
1083 1083
		[osf*],    # ccc
1084 1084
			[CFLAGS="-ieee $CFLAGS"],
1085
		)])
1085
		)],
1086
[sparc*], [AC_LIBOBJ([sparc])])
1086 1087

  
1087 1088
ac_cv_header_net_socket_h=${ac_cv_header_net_socket_h=no}
1088 1089
if test "$ac_cv_header_net_socket_h" = yes; then
include/ruby/defines.h 2011-10-25 13:54:21.000000000 +0100 โ†’ include/ruby/defines.h 2011-11-02 20:07:56.000000000 +0000
197 197
        /* MB_CUR_MAX will not work well in C locale */
198 198
#endif
199 199

  
200
#if defined(__sparc)
201
static inline void
202
flush_register_windows(void)
203
{
204
    asm
205
#ifdef __GNUC__
206
	volatile
207
#endif
208
# if SIZEOF_VOIDP > 4		/* workaround for Debian Sparc quirk */
209
	("flushw")
210
# else
211
	("ta 0x03")
212
# endif /* trap always to flush register windows if we are on a Sparc system */
213
	;
214
}
215
#  define FLUSH_REGISTER_WINDOWS flush_register_windows()
200
#if defined(sparc) || defined(__sparc__)
201
void flush_sparc_register_windows();
202
#define FLUSH_REGISTER_WINDOWS flush_sparc_register_windows()
216 203
#elif defined(__ia64)
217 204
void *rb_ia64_bsp(void);
218 205
void rb_ia64_flushrs(void);
sparc.c 1970-01-01 01:00:00.000000000 +0100 โ†’ sparc.c 2011-11-02 20:07:56.000000000 +0000
1
/********************************************************************
2
 Flush register windows on sparc.
3

  
4
 This function is in a separate file to prevent inlining. The "flushw"
5
 assembler instruction used on sparcv9 flushes all register windows
6
 except the current one, so if it is inlined, the current register
7
 window of the process executing the instruction will not be flushed
8
 correctly.
9

  
10
 See http://redmine.ruby-lang.org/issues/5244 for discussion.
11
*********************************************************************/
12
void flush_sparc_register_windows()
13
{
14
    asm
15
#ifdef __GNUC__
16
    __volatile__
17
#endif
18

  
19
/* This condition should be in sync with one in configure.in */
20
#if defined(__sparcv9) || defined(__sparc_v9__)
21
    ("flushw" : : : "%o7")
22
#else
23
    ("ta 0x03")
24
#endif
25
    ;
26
}