jcf-write.c (push_long_const): lo, hi: New variables.

2002-04-19  Andrew Haley  <aph@redhat.com>

        * jcf-write.c (push_long_const): lo, hi: New variables.
        Use rshift_double to extract the high part of a 64-bit long.
        Use WORD_TO_INT to extract the low part.

        * jcf-parse.c (get_constant): CONSTANT_Integer: Use an unsigned
        HOST_WIDE_INT for num.  Use JPOOL_UINT to get it.
        CONSTANT_Double: Use JPOOL_UINT to get both halve of a double.

From-SVN: r52618
This commit is contained in:
Andrew Haley 2002-04-22 16:55:39 +00:00 committed by Andrew Haley
parent 0a528c61ff
commit a2761d6826
3 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,13 @@
2002-04-19 Andrew Haley <aph@redhat.com>
* jcf-write.c (push_long_const): lo, hi: New variables.
Use rshift_double to extract the high part of a 64-bit long.
Use WORD_TO_INT to extract the low part.
* jcf-parse.c (get_constant): CONSTANT_Integer: Use an unsigned
HOST_WIDE_INT for num. Use JPOOL_UINT to get it.
CONSTANT_Double: Use JPOOL_UINT to get both halve of a double.
2002-04-18 Neil Booth <neil@daikokuya.demon.co.uk>
* typeck.c (incomplete_type_error): Remove.

View File

@ -292,10 +292,10 @@ get_constant (jcf, index)
}
case CONSTANT_Long:
{
jint num = JPOOL_INT (jcf, index);
unsigned HOST_WIDE_INT num = JPOOL_UINT (jcf, index);
HOST_WIDE_INT lo, hi;
lshift_double (num, 0, 32, 64, &lo, &hi, 0);
num = JPOOL_INT (jcf, index+1) & 0xffffffff;
num = JPOOL_UINT (jcf, index+1);
add_double (lo, hi, num, 0, &lo, &hi);
value = build_int_2 (lo, hi);
TREE_TYPE (value) = long_type_node;
@ -316,9 +316,9 @@ get_constant (jcf, index)
HOST_WIDE_INT num[2];
REAL_VALUE_TYPE d;
HOST_WIDE_INT lo, hi;
num[0] = JPOOL_INT (jcf, index);
num[0] = JPOOL_UINT (jcf, index);
lshift_double (num[0], 0, 32, 64, &lo, &hi, 0);
num[0] = JPOOL_INT (jcf, index+1);
num[0] = JPOOL_UINT (jcf, index+1);
add_double (lo, hi, num[0], 0, &lo, &hi);
/* Since ereal_from_double expects an array of HOST_WIDE_INT

View File

@ -853,15 +853,20 @@ push_long_const (lo, hi, state)
HOST_WIDE_INT lo, hi;
struct jcf_partial *state;
{
if (hi == 0 && lo >= 0 && lo <= 1)
HOST_WIDE_INT highpart, dummy;
jint lowpart = WORD_TO_INT (lo);
rshift_double (lo, hi, 32, 64, &highpart, &dummy, 1);
if (highpart == 0 && (lowpart == 0 || lowpart == 1))
{
RESERVE(1);
OP1(OPCODE_lconst_0 + lo);
OP1(OPCODE_lconst_0 + lowpart);
}
else if ((hi == 0 && (jword)(lo & 0xFFFFFFFF) < 32768)
|| (hi == -1 && (lo & 0xFFFFFFFF) >= (jword)-32768))
else if ((highpart == 0 && lowpart > 0 && lowpart < 32768)
|| (highpart == -1 && lowpart < 0 && lowpart >= -32768))
{
push_int_const (lo, state);
push_int_const (lowpart, state);
RESERVE (1);
OP1 (OPCODE_i2l);
}