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

Catch blocks should not be generated inline.

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_2.5.1

      Description

      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);
      }
          }
      }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: