Bug#230601: Arm floating point format

2006-10-20 Thread Adam Majer
I'll test it this weekend.

Thank you!
Adam


Ben Hutchings wrote:
 Here's a patch that may fix the bug, but I haven't yet been able to test
 it.
 
 Ben.
 
 --- jikes-1.22/src/double.h.orig  2004-06-02 12:26:22.0 +0100
 +++ jikes-1.22/src/double.h   2006-10-19 11:38:23.0 +0100
 @@ -63,6 +63,11 @@
  #include platform.h
  #include long.h
  
 +// We should really have an autoconf test for this, but autoconf hates me.
 +#if defined(WORDS_BIGENDIAN) || (defined(__arm__)  !defined(__VFP_FP__))
 +#define DOUBLES_BIGENDIAN_WORDS
 +#endif
 +
  #ifdef HAVE_JIKES_NAMESPACE
  namespace Jikes { // Open namespace Jikes block
  #endif
 @@ -395,7 +400,25 @@
  static const IEEEdouble bigtens[]; // powers of 10 by powers of 2
  #endif
  
 +#if defined(WORDS_BIGENDIAN) != defined(DOUBLES_BIGENDIAN_WORDS)
 +// This is sick, but then so is this entire class hierarchy.
 +inline void setHighWord(u4 high) { BaseLong::setLowWord(high); }
 +inline void setLowWord(u4 low) { BaseLong::setHighWord(low); }
 +using BaseLong::setHighAndLowWords;
 +inline void setHighAndLowWords(u4 high, u4 low)
 +{ BaseLong::setHighAndLowWords(low, high); }
 +#endif
 +#ifdef HAVE_64BIT_TYPES
 +// This really isn't going to help anyone.  Make it private.
 +using BaseLong::Words;
 +#endif
 +
  public:
 +#if defined(WORDS_BIGENDIAN) != defined(DOUBLES_BIGENDIAN_WORDS)
 +inline u4 HighWord() const { return BaseLong::LowWord(); }
 +inline u4 LowWord() const { return BaseLong::HighWord(); }
 +#endif
 +
  //
  // Information methods, for evaluating components of the float
  //
 -- END --
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#230601: Arm floating point format

2006-10-20 Thread Ben Hutchings
I wrote:
 Here's a patch that may fix the bug, but I haven't yet been able to test
 it.

I've now tested this with Adam Majer's test case.  I compiled with a
patched jikes and unpatched jikes-gij on ARM, then ran the class file on
an i386.  The output is as expected, i.e.:

$ java test
Boltzmann: 1.3806503E-23

Ben.

-- 
Ben Hutchings -- [EMAIL PROTECTED] shortened to [EMAIL PROTECTED]
If you've signed my GPG key, please send a signature on and to the new uid.
For every complex problem
there is a solution that is simple, neat, and wrong.


signature.asc
Description: This is a digitally signed message part


Bug#230601: Arm floating point format

2006-10-19 Thread Ben Hutchings
Here's a patch that may fix the bug, but I haven't yet been able to test
it.

Ben.

--- jikes-1.22/src/double.h.orig2004-06-02 12:26:22.0 +0100
+++ jikes-1.22/src/double.h 2006-10-19 11:38:23.0 +0100
@@ -63,6 +63,11 @@
 #include platform.h
 #include long.h
 
+// We should really have an autoconf test for this, but autoconf hates me.
+#if defined(WORDS_BIGENDIAN) || (defined(__arm__)  !defined(__VFP_FP__))
+#define DOUBLES_BIGENDIAN_WORDS
+#endif
+
 #ifdef HAVE_JIKES_NAMESPACE
 namespace Jikes { // Open namespace Jikes block
 #endif
@@ -395,7 +400,25 @@
 static const IEEEdouble bigtens[]; // powers of 10 by powers of 2
 #endif
 
+#if defined(WORDS_BIGENDIAN) != defined(DOUBLES_BIGENDIAN_WORDS)
+// This is sick, but then so is this entire class hierarchy.
+inline void setHighWord(u4 high) { BaseLong::setLowWord(high); }
+inline void setLowWord(u4 low) { BaseLong::setHighWord(low); }
+using BaseLong::setHighAndLowWords;
+inline void setHighAndLowWords(u4 high, u4 low)
+{ BaseLong::setHighAndLowWords(low, high); }
+#endif
+#ifdef HAVE_64BIT_TYPES
+// This really isn't going to help anyone.  Make it private.
+using BaseLong::Words;
+#endif
+
 public:
+#if defined(WORDS_BIGENDIAN) != defined(DOUBLES_BIGENDIAN_WORDS)
+inline u4 HighWord() const { return BaseLong::LowWord(); }
+inline u4 LowWord() const { return BaseLong::HighWord(); }
+#endif
+
 //
 // Information methods, for evaluating components of the float
 //
-- END --

-- 
Ben Hutchings -- [EMAIL PROTECTED] shortened to [EMAIL PROTECTED]
If you've signed my GPG key, please send a signature on and to the new uid.
For every complex problem
there is a solution that is simple, neat, and wrong.


signature.asc
Description: This is a digitally signed message part


Bug#230601: Arm floating point format

2006-10-16 Thread Wookey
This problem is almost certanly due to the unusual double format used
on arm (which is old ABI, little endian on debian currently).

The two 32-bit words are arranged big-endian, whilst the bytes withint
each word are arranged little-endian. This (odd, but IEEE-754
compliant) format is unique to arm. i.e. double format bytes are laid
out 56781234

(on armeb it is big-endian word, big-endian bytes). Same on armel
(forthcoming EABI distribution).

That is probably enough info for those familiar with the code to fix
the problem. I'll take a look now and see if I can workout the right
runes.

To make it work for the existing arm arch and for armeb and armel use
this compiler directive to surround code swaping the bytes about:

#if defined(__arm__)  !defined(__vfp__)  (__ARMEL__)
swap top word and bottom word


Wookey
-- 
Aleph One Ltd, Bottisham, CAMBRIDGE, CB5 9BA, UK  Tel +44 (0) 1223 811679
work: http://www.aleph1.co.uk/ play: http://wookware.org/


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]