From 99fd3aa53848b51fdd189d0814c744ce4b89de88 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Wed, 2 Jun 1999 11:00:44 +0000 Subject: [PATCH] [multiple changes] Wed Jun 2 10:44:38 1999 Anthony Green * except.c (link_handler): Chain exception handlers in order. Wed Jun 2 10:41:24 1999 Anthony Green * 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 * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as constant. (From egcs posted patches.) From-SVN: r27314 --- gcc/java/ChangeLog | 15 +++++++++++++++ gcc/java/class.c | 2 ++ gcc/java/except.c | 2 +- gcc/java/expr.c | 36 +++++++++++++++++++++++++++++------- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 35e7d99..e7e0544 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,18 @@ +Wed Jun 2 10:44:38 1999 Anthony Green + + * except.c (link_handler): Chain exception handlers in order. + +Wed Jun 2 10:41:24 1999 Anthony Green + + * 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 + + * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as + constant. + Fri May 28 18:22:45 1999 Alexandre Petit-Bianco * parse.y (lookup_field_wrapper): Unified returned value to NULL diff --git a/gcc/java/class.c b/gcc/java/class.c index 4fea18d..8217a95 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -583,6 +583,7 @@ build_utf8_ref (name) TREE_TYPE (string) = str_type; PUSH_FIELD_VALUE (cinit, "data", string); FINISH_RECORD_CONSTRUCTOR (cinit); + TREE_CONSTANT (cinit) = 1; /* Build a unique identifier based on buf. */ sprintf(buf, "_Utf%d", ++utf8_count); @@ -608,6 +609,7 @@ build_utf8_ref (name) DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; TREE_READONLY (decl) = 1; + TREE_THIS_VOLATILE (decl) = 0; DECL_INITIAL (decl) = cinit; TREE_CHAIN (decl) = utf8_decl_list; layout_decl (decl, 0); diff --git a/gcc/java/except.c b/gcc/java/except.c index 0e6eb39..c8674f3 100644 --- a/gcc/java/except.c +++ b/gcc/java/except.c @@ -118,7 +118,7 @@ link_handler (range, outer) if (range->start_pc == outer->start_pc && range->end_pc == outer->end_pc) { - outer->handlers = chainon (range->handlers, outer->handlers); + outer->handlers = chainon (outer->handlers, range->handlers); return; } 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 -- 2.7.4