diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 48884bb56d2..da51e18635d 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,13 @@ +2002-04-19 Andrew Haley + + * 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 * typeck.c (incomplete_type_error): Remove. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 53e647cb2c6..cbf5ac9834c 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -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 diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 215d0c56c17..2988c4726b8 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -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); }