[kaffe] CVS kaffe (robilad): fixed check if words need to be switched on arm

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 16 09:13:29 PST 2008


PatchSet 7758 
Date: 2008/02/16 17:11:39
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
fixed check if words need to be switched on arm

2008-02-16  Dalibor Topic  <robilad at kaffe.org>

* kaffe/kaffevm/constants.c (readConstantPool): Use
check_if_need_to_switch_words_in_jdouble instead of checking
if DOUBLE_ORDER_OPPOSITE is defined.
(check_if_need_to_switch_words_in_jdouble): New static helper function.

* config/config-hacks.h (DOUBLE_ORDER_OPPOSITE): Removed.

Members: 
	ChangeLog:1.5258->1.5259 
	config/config-hacks.h:1.18->1.19 
	kaffe/kaffevm/constants.c:1.21->1.22 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5258 kaffe/ChangeLog:1.5259
--- kaffe/ChangeLog:1.5258	Sat Feb 16 00:49:40 2008
+++ kaffe/ChangeLog	Sat Feb 16 17:11:39 2008
@@ -1,5 +1,14 @@
 2008-02-16  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/constants.c (readConstantPool): Use 
+	check_if_need_to_switch_words_in_jdouble instead of checking 
+	if DOUBLE_ORDER_OPPOSITE is defined.
+	(check_if_need_to_switch_words_in_jdouble): New static helper function.
+
+	* config/config-hacks.h (DOUBLE_ORDER_OPPOSITE): Removed.
+
+2008-02-16  Dalibor Topic  <robilad at kaffe.org>
+
 	* THIRDPARTY: Added license information for files imported 
 	from GNU Classpath and GCC.
 
Index: kaffe/config/config-hacks.h
diff -u kaffe/config/config-hacks.h:1.18 kaffe/config/config-hacks.h:1.19
--- kaffe/config/config-hacks.h:1.18	Tue Jun 21 16:41:36 2005
+++ kaffe/config/config-hacks.h	Sat Feb 16 17:11:41 2008
@@ -65,18 +65,6 @@
 #define	HAVE_UNALIGNEDACCESS
 #endif
 
-/* On arm, word order of doubles is always big endian when
- * using FPA. When using VFP, word order of doubles follows
- * the word order of the memory system.
- *
- * Therefore, the word order of doubles is opposite to the
- * word order of jlongs when using a little endian arm
- * unless VFP is used.
- */
-#if defined(__ARMEL__) && !defined(__VFP_FP__)
-#define DOUBLE_ORDER_OPPOSITE
-#endif
-
 /*
  * GCC before 3.0 does not support explicit branch optimization.
  */
Index: kaffe/kaffe/kaffevm/constants.c
diff -u kaffe/kaffe/kaffevm/constants.c:1.21 kaffe/kaffe/kaffevm/constants.c:1.22
--- kaffe/kaffe/kaffevm/constants.c:1.21	Sat Apr 22 12:40:03 2006
+++ kaffe/kaffe/kaffevm/constants.c	Sat Feb 16 17:11:41 2008
@@ -28,6 +28,21 @@
 /*
  * XXX move into readClass.c
  */
+/**
+ * Check if the words making up a jdouble need to be 
+ * switched around. Necessary for some ARM systems.
+ */
+static
+jboolean check_if_need_to_switch_words_in_jdouble(void) {
+  jvalue val; 
+
+  /* -0.0 as an IEEE754 double is 0x80000000000000LL, i.e. < 0LL.
+   * If the words in the double are switched around, then the 
+   * bit pattern will be 0x0000000080000000LL, i.e. > 0LL. 
+   */
+  val.d = -0.0;
+  return val.j > 0;
+}
 
 /*
  * Read in constant pool from opened file.
@@ -168,23 +183,23 @@
 			readu4(&d4b, fp);
 
 #if SIZEOF_VOID_P == 8
-#if defined(DOUBLE_ORDER_OPPOSITE)
-			pool[i] = WORDS_TO_LONG(d4b, d4);
-#else
-			pool[i] = WORDS_TO_LONG(d4, d4b);
-#endif /* DOUBLE_ORDER_OPPOSITE */
+			if(check_if_need_toswitch_words_in_jdouble())
+			  pool[i] = WORDS_TO_LONG(d4b, d4);
+			else
+			  pool[i] = WORDS_TO_LONG(d4, d4b);
 			i++;
 			pool[i] = 0;
 #else
-#if defined(DOUBLE_ORDER_OPPOSITE)
-			pool[i] = d4b;
-			i++;
-			pool[i] = d4;
-#else
-			pool[i] = d4;
-			i++;
-			pool[i] = d4b;
-#endif /* DOUBLE_ORDER_OPPOSITE */
+			if (check_if_need_to_switch_words_in_jdouble()) {
+			  pool[i] = d4b;
+			  i++;
+			  pool[i] = d4;
+			}
+			else {
+			  pool[i] = d4;
+			  i++;
+			  pool[i] = d4b;
+			}
 #endif /* SIZEOF_VOID_P == 8 */
 			tags[i] = CONSTANT_Unknown;
 			break;




More information about the kaffe mailing list