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

try/catch not generated around monitorexit for synchronized statement

XMLWordPrintable

    • b103
    • 8
    • sparc
    • solaris_10

      Two JCK tests start failing since jdk8-b103:

      lang/STMT/stmt109/stmt10902m15/stmt10902m15.html
      lang/STMT/stmt109/stmt10902m20/stmt10902m20.html

      Reduced code is:

      -------------------
      package pack;
      import java.io.PrintStream;
      public class test {

      //-------- Variant: 586 --------------------------------
      void break2_inner_sync_block_do (int arg) {
          int loc = 0;
          label0:
          synchronized (new Integer(arg)) {
              label1:
              {
                  label2:
                  do {
                      break label2;
                  } while (arg != 0);
              }
          }
      }

      //-------- Variant: 578 --------------------------------
      void break2_inner_sync_block_block (int arg) {
          int loc = 0;
          label0:
          synchronized (new Integer(arg)) {
              label1:
              {
                  label2:
                  {
                      break label2;
                  }
              }
          }
      }

          public static void main(String args[]) {
              System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
          }

          public static int run(String args[],PrintStream out) {
              test x = new test();
              x.break2_inner_sync_block_do(1);
              x.break2_inner_sync_block_block(1);
              return 0;/*STATUS_PASSED*/
          }

      }
      -------------------

      Generated code (commented is missed compared with b99):

      Method break2_inner_sync_block_do:"(I)V"
          stack 3 locals 5
      {
              iconst_0;
              istore_2;
              new class java/lang/Integer;
              dup;
              iload_1;
              invokespecial Method java/lang/Integer."<init>":"(I)V";
              dup;
              astore_3;
              monitorenter;
                  // try t0;
              aload_3;
              monitorexit;
              // endtry t0;
              // goto L25;
              // catch t0 #0;
              // catch t1 #0;
              // try t1;
              // astore 4;
              // aload_3;
              // monitorexit;
              // endtry t1;
              // aload 4;
              // athrow;
          L25: return;
      }

            vromero Vicente Arturo Romero Zaldivar
            larbouzo Leonid Arbuzov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: