* Re: Java floating-point mess
[not found] <20020404115615.04DBBF28C0@nile.gnat.com>
@ 2002-04-04 13:11 ` Zack Weinberg
2002-04-05 3:13 ` Andrew Haley
0 siblings, 1 reply; 5+ messages in thread
From: Zack Weinberg @ 2002-04-04 13:11 UTC (permalink / raw)
To: Robert Dewar; +Cc: gcc, java
On Thu, Apr 04, 2002 at 06:56:15AM -0500, Robert Dewar wrote:
> <<The Java front end has a number of places that assume not only that
> the host and target floating point formats are identical, but that
> both are IEEE. I've tried to get rid of them, but run afoul of its
> not being possible to link real.o into gcjh -- it wants to drag in
> most of the back end.
> >>
>
> Presumably the complaint is about assuming that the host fpt format is
> IEEE, the target fpt format presumably MUST be IEEE, since this is required
> by Java, no?
Well, the Java front end doesn't appear to take any special care to
ensure that SFmode is IEEE single and DFmode double. (We'd have to
have a floating point emulator library built into libjava that
implemented IEEE fp, to get it right for non-IEEE targets.) But yes,
the code I'm looking at right now is only for the host side.
Thinking out loud... The major problem is with gjavah, which wants to
read in a .class file and print out things like
const jdouble pi = 3.1415926... ;
which are then going to be interpreted by the C++ compiler -- come to
think of it, there is no way to win here on a non-IEEE target.
Ignoring the language spec and using the target's floating point,
whatever it happens to be, might be the sanest thing to do from an
interoperability standpoint.
I think I can get around the immediate problem by using C99
hexadecimal floating-point constants.
[I should have cc:ed java@ from the beginning -- the original message
is at http://gcc.gnu.org/ml/gcc/2002-04/msg00135.html if anyone's
interested.]
zw
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Java floating-point mess
2002-04-04 13:11 ` Java floating-point mess Zack Weinberg
@ 2002-04-05 3:13 ` Andrew Haley
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2002-04-05 3:13 UTC (permalink / raw)
To: Zack Weinberg; +Cc: Robert Dewar, gcc, java
Zack Weinberg writes:
> On Thu, Apr 04, 2002 at 06:56:15AM -0500, Robert Dewar wrote:
> > <<The Java front end has a number of places that assume not only that
> > the host and target floating point formats are identical, but that
> > both are IEEE. I've tried to get rid of them, but run afoul of its
> > not being possible to link real.o into gcjh -- it wants to drag in
> > most of the back end.
> > >>
> >
> > Presumably the complaint is about assuming that the host fpt
> > format is IEEE, the target fpt format presumably MUST be IEEE,
> > since this is required by Java, no?
>
> Well, the Java front end doesn't appear to take any special care to
> ensure that SFmode is IEEE single and DFmode double. (We'd have to
> have a floating point emulator library built into libjava that
> implemented IEEE fp, to get it right for non-IEEE targets.) But yes,
> the code I'm looking at right now is only for the host side.
>
> Thinking out loud... The major problem is with gjavah, which wants to
> read in a .class file and print out things like
>
> const jdouble pi = 3.1415926... ;
>
> which are then going to be interpreted by the C++ compiler -- come to
> think of it, there is no way to win here on a non-IEEE target.
Right -- Java requires that the target FP format be IEEE. We don't
support Java on non-IEEE targets. We can solve any build problems by
not building Java on hosts that are non-IEEE.
The only issue here is that we won't be able to cross-compile Java on
a VAX or somesuch, isn't it? Or am I missing something here?
Andrew.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Java floating-point mess
@ 2002-04-08 13:14 Robert Dewar
0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 2002-04-08 13:14 UTC (permalink / raw)
To: dewar, tromey; +Cc: aph, gcc, java, zack
<<The front end is required to do these computations in some contexts,
namely compile-time constants. This is a concern to us, but it isn't
immediately pressing. We already violate the spec with respect to
compile-time constants in several ways.
>>
Sure, of course I understand that, but these computations should be done
using simulated IEEE arithmetic rather than host arithmetic.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Java floating-point mess
2002-04-05 7:02 Robert Dewar
@ 2002-04-08 13:02 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2002-04-08 13:02 UTC (permalink / raw)
To: Robert Dewar; +Cc: aph, zack, gcc, java
>>>>> "Robert" == Robert Dewar <dewar@gnat.com> writes:
Andrew> The only issue here is that we won't be able to cross-compile
Andrew> Java on a VAX or somesuch, isn't it? Or am I missing
Andrew> something here?
Robert> That sounds right provided that the front end is not trying to
Robert> use host floating-point arithmetic to precompute expressions
Robert> (IEEE is not nearly enough of an absolute standard for this to
Robert> give the right results in all cases).
The front end is required to do these computations in some contexts,
namely compile-time constants. This is a concern to us, but it isn't
immediately pressing. We already violate the spec with respect to
compile-time constants in several ways.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Java floating-point mess
@ 2002-04-05 7:02 Robert Dewar
2002-04-08 13:02 ` Tom Tromey
0 siblings, 1 reply; 5+ messages in thread
From: Robert Dewar @ 2002-04-05 7:02 UTC (permalink / raw)
To: aph, zack; +Cc: dewar, gcc, java
<<The only issue here is that we won't be able to cross-compile Java on
a VAX or somesuch, isn't it? Or am I missing something here?
>>
That sounds right provided that the front end is not trying to use host
floating-point arithmetic to precompute expressions (IEEE is not nearly
enough of an absolute standard for this to give the right results in
all cases).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-04-08 20:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020404115615.04DBBF28C0@nile.gnat.com>
2002-04-04 13:11 ` Java floating-point mess Zack Weinberg
2002-04-05 3:13 ` Andrew Haley
2002-04-05 7:02 Robert Dewar
2002-04-08 13:02 ` Tom Tromey
2002-04-08 13:14 Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).