[multiple changes]
authorAnthony Green <green@cygnus.com>
Wed, 2 Jun 1999 11:00:44 +0000 (11:00 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Wed, 2 Jun 1999 11:00:44 +0000 (04:00 -0700)
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

gcc/java/ChangeLog
gcc/java/class.c
gcc/java/except.c
gcc/java/expr.c

index 35e7d99f966c4999db8fdc2b198bd8b4d6d2cc8f..e7e05447e339741b470da05ff3faf0f22431b96c 100644 (file)
@@ -1,3 +1,18 @@
+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.
+
 Fri May 28 18:22:45 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
         * parse.y (lookup_field_wrapper): Unified returned value to NULL
index 4fea18d197fc6958632ee6b8ec2f81b82d3251c8..8217a9507687afb9d1a2d292014a14d87c662dfa 100644 (file)
@@ -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);
index 0e6eb398f8f023d49ce55fdcfa911fe93e525ee5..c8674f31f28c4cebf83d2db12985faf8b5476c36 100644 (file)
@@ -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;
     }
 
index 64651f5ddc75f29a696adb6fc46e6fbf5c23d44f..9beb724ea377a1db3ca04ff6138febaf597df504 100644 (file)
@@ -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