* [gcjx] Patch: FYI: use canonical NaN values
@ 2006-01-19 18:13 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2006-01-19 18:13 UTC (permalink / raw)
To: Java Patch List
I'm checking this in on the gcjx branch.
The japi run on builder.classpath.org pointed out a buglet in gcjx's
class generation code. It wasn't emitting the canonical NaN values
into the constant pool. Fixed as appended.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* bytecode/outpool.cc (add(jdouble)): Use canonical NaN
representation.
(add(jfloat)): Likewise.
Index: bytecode/outpool.cc
===================================================================
--- bytecode/outpool.cc (revision 108950)
+++ bytecode/outpool.cc (working copy)
@@ -1,6 +1,6 @@
// A constant pool being generated.
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -67,7 +67,7 @@
template<typename T>
int
outgoing_constant_pool::check_qual (std::map<T, type_map_type> &the_map,
- model_type *the_type, T the_value)
+ model_type *the_type, T the_value)
{
typename std::map<T, type_map_type>::iterator iter
= the_map.find (the_value);
@@ -268,7 +268,12 @@
int
outgoing_constant_pool::add (jfloat val)
{
- jint w = float_to_word (val);
+ // Use Java's canonical NaN value.
+ jint w;
+ if (isnan (val))
+ w = 0x7fc00000;
+ else
+ w = float_to_word (val);
int index = check (float_map, w);
if (index < 0)
{
@@ -286,7 +291,16 @@
outgoing_constant_pool::add (jdouble val)
{
jint words[2];
- double_to_words (words, val);
+
+ // Use Java's canonical NaN value.
+ if (isnan (val))
+ {
+ words[0] = 0x7ff80000;
+ words[1] = 0;
+ }
+ else
+ double_to_words (words, val);
+
// Note that order of words here doesn't matter, since this
// representation is for internal use only.
jlong lval = words_to_long (words[0], words[1]);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-01-19 18:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 18:13 [gcjx] Patch: FYI: use canonical NaN values Tom Tromey
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).