]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jcf-write.c (generate_bytecode_insns): For increments and decrements just recurse...
authorPer Bothner <per@bothner.com>
Tue, 28 Aug 2001 22:18:57 +0000 (15:18 -0700)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 28 Aug 2001 22:18:57 +0000 (15:18 -0700)
* jcf-write.c  (generate_bytecode_insns):  For increments and
        decrements just recurse to push constant.  Improvement on Mark's patch.

From-SVN: r45241

gcc/java/ChangeLog
gcc/java/jcf-write.c

index 60d7527f1ad08dfb7730c535a043486d74934781..45f05d8804d7091fd79a6fa3e7ff192e20210404 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-28  Per Bothner  <per@bothner.com>
+
+       * jcf-write.c  (generate_bytecode_insns):  For increments and
+        decrements just recurse to push constant.  Improvement on Mark's patch.
+
 2001-08-28  Mark Mitchell  <mark@codesourcery.com>
 
        * jcf-write.c (generate_bytecode_insns): Generate an integer to
index 383cc6a7c7aaa62d549a6a5032920e9b0585ceed..31493fd0aaedd8d6fb11dbd6226433bfb30fd0a1 100644 (file)
@@ -1442,7 +1442,7 @@ generate_bytecode_insns (exp, target, state)
      int target;
      struct jcf_partial *state;
 {
-  tree type;
+  tree type, arg;
   enum java_opcode jopcode;
   int op;
   HOST_WIDE_INT value;
@@ -1908,6 +1908,7 @@ generate_bytecode_insns (exp, target, state)
     case POSTINCREMENT_EXPR: value =  1; post_op = 1;  goto increment;
     increment:
 
+      arg = TREE_OPERAND (exp, 1);
       exp = TREE_OPERAND (exp, 0);
       type = TREE_TYPE (exp);
       size = TYPE_IS_WIDE (type) ? 2 : 1;
@@ -1960,19 +1961,10 @@ generate_bytecode_insns (exp, target, state)
       /* Stack, if ARRAY_REF:  ..., [result, ] array, index, oldvalue. */
       /* Stack, if COMPONENT_REF:  ..., [result, ] objectref, oldvalue. */
       /* Stack, otherwise:  ..., [result, ] oldvalue. */
-      if (size == 1 || TREE_CODE (type) == REAL_TYPE)
-       {
-         push_int_const (value, state);
-         if (TREE_CODE (type) == REAL_TYPE)
-           {
-             RESERVE (1);
-             OP1 (TYPE_PRECISION (type) == 32 ? OPCODE_i2f : OPCODE_i2d);
-           }
-       }
-      else
-       push_long_const (value, (HOST_WIDE_INT)(value >= 0 ? 0 : -1), state);
-      NOTE_PUSH (size);
-      emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state);
+      generate_bytecode_insns (arg, STACK_TARGET, state);
+      emit_binop ((value >= 0 ? OPCODE_iadd : OPCODE_isub)
+                 + adjust_typed_op (type, 3),
+                 type, state);
       if (target != IGNORE_TARGET && ! post_op)
        emit_dup (size, offset, state);
       /* Stack, if ARRAY_REF:  ..., [result, ] array, index, newvalue. */