Optimize: `return (a ? b : c)' as: `if (a) return b; else return c;'.
authorPer Bothner <bothner@gcc.gnu.org>
Tue, 2 Feb 1999 12:20:39 +0000 (04:20 -0800)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 2 Feb 1999 12:20:39 +0000 (04:20 -0800)
Optimize: `return (a ? b : c)' as: `if (a) return b; else return c;'.
* jcf-write.c (generate_bytecode_return):  New function.
(generate_bytecode_insns):  Use it, for RETURN_EXPR.
* jcf-write.c (generate_bytecode_insns):  For REAL_CST that is 0 or 1,
generate special [fd]const_[01] instructions.
* jcf-parse.c (yyparse):  Don't emit_register_classes if -fsyntax-only.
* verify.c (verify_jvm_instructions):  Do INVALIDATE_PC after
handling OPCODE_lookupswitch or OPCODE_tableswitch.

From-SVN: r24972

gcc/java/jcf-parse.c
gcc/java/verify.c

index 240f638cc6c776c8b609a3abf27d2ee245b958be..23f56a684b61d3a72592410b93f2e78aee992315 100644 (file)
@@ -841,7 +841,7 @@ yyparse ()
     }
 
   java_expand_classes ();
-  if (!java_report_errors () && !flag_emit_class_files)
+  if (!java_report_errors () && !flag_syntax_only)
     emit_register_classes ();
   return 0;
 }
index 8cd3c663852fc893f88b34f0e7c0a83585ac30c2..a6771dbde91210ad07c279744a4af21430e510ed 100644 (file)
@@ -979,6 +979,7 @@ verify_jvm_instructions (jcf, byte_ops, length)
 
            while (low++ <= high)
              PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s4));
+           INVALIDATE_PC;
            break;
          }
 
@@ -1010,6 +1011,7 @@ verify_jvm_instructions (jcf, byte_ops, length)
                last = match;
                PUSH_PENDING (lookup_label (oldpc + IMMEDIATE_s4));
              }
+           INVALIDATE_PC;
            break;
          }