aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorAnthony Green <green@cygnus.com>1999-06-02 11:00:44 +0000
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>1999-06-02 04:00:44 -0700
commit99fd3aa53848b51fdd189d0814c744ce4b89de88 (patch)
tree0f64a63d2b918e891fcc6f98890d1923a8cd605e /gcc/java/expr.c
parentc237e586270fd3e4fe9feb0fa1826ddc92225d14 (diff)
downloadgcc-99fd3aa53848b51fdd189d0814c744ce4b89de88.zip
gcc-99fd3aa53848b51fdd189d0814c744ce4b89de88.tar.gz
gcc-99fd3aa53848b51fdd189d0814c744ce4b89de88.tar.bz2
[multiple changes]
Wed Jun 2 10:44:38 1999 Anthony Green <green@cygnus.com> * except.c (link_handler): Chain exception handlers in order. Wed Jun 2 10:41:24 1999 Anthony Green <green@cygnus.com> * expr.c (expand_byte_code): Fill unreachable bytecode regions with nops and process as usual in order to always set correct EH ranges. Emit detailed warnings about unreachable bytecodes. Wed Jun 2 10:35:13 1999 Anthony Green <green@cygnus.com> * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as constant. (From egcs posted patches.) From-SVN: r27314
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 64651f5..9beb724 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -1986,6 +1986,7 @@ expand_byte_code (jcf, method)
int i;
int saw_index;
unsigned char *linenumber_pointer;
+ int dead_code_index = -1;
#undef RET /* Defined by config/i386/i386.h */
#undef AND /* Causes problems with opcodes for iand and land. */
@@ -2164,15 +2165,29 @@ expand_byte_code (jcf, method)
if (! (instruction_bits [PC] & BCODE_VERIFIED))
{
- /* never executed - skip */
- warning ("Some bytecode operations (starting at pc %d) can never be executed", PC);
- while (PC < length
- && ! (instruction_bits [PC] & BCODE_VERIFIED))
- PC++;
- continue;
+ if (dead_code_index == -1)
+ {
+ /* This is the start of a region of unreachable bytecodes.
+ They still need to be processed in order for EH ranges
+ to get handled correctly. However, we can simply
+ replace these bytecodes with nops. */
+ dead_code_index = PC;
+ }
+
+ /* Turn this bytecode into a nop. */
+ byte_ops[PC] = 0x0;
+ }
+ else
+ {
+ if (dead_code_index != -1)
+ {
+ /* We've just reached the end of a region of dead code. */
+ warning ("Unreachable bytecode from %d to before %d.",
+ dead_code_index, PC);
+ dead_code_index = -1;
+ }
}
-
/* Handle possible line number entry for this PC.
This code handles out-of-order and multiple linenumbers per PC,
@@ -2204,6 +2219,13 @@ expand_byte_code (jcf, method)
maybe_poplevels (PC);
maybe_end_try (PC);
} /* for */
+
+ if (dead_code_index != -1)
+ {
+ /* We've just reached the end of a region of dead code. */
+ warning ("Unreachable bytecode from %d to the end of the method.",
+ dead_code_index);
+ }
}
static void