Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4145769

Catch blocks should not be generated inline.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 1.2.0
    • tools
    • generic
    • solaris_2.5.1

      The catch blocks for try-catch statements are generated inline. This means
      that we can end up with a goto in the middle of a loop that does
      a try-catch. This penalizes the use of try-catch even when it is not used.

      Don't believe me? Compile and disassemble the following code:

      public class TryLoop {
          public static void foobar() throws Exception {
      System.out.println("hello");
          }

          public static void main(String[] args) {
      for (int i = 0; i < 10; i++) {
      System.out.println(i);
      try {
      foobar();
      } catch (Exception ee) {
      System.out.println("Exception");
      }
      System.out.println(i);
      }
          }
      }

            gafter Neal Gafter (Inactive)
            tturnidgsunw Todd Turnidge (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: