1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 super public class TestRangeCheckExceptionHandlerLoop
  26         version 51:0
  27 {
  28 
  29 
  30 public Method "<init>":"()V"
  31         stack 1 locals 1
  32 {
  33                 aload_0;
  34                 invokespecial   Method java/lang/Object."<init>":"()V";
  35                 return;
  36 }
  37 
  38 /* This method has an irreducible loop, with 2 entries, one is the exception handler
  39 
  40     static void test(boolean flag, int[] array, Exception exception) throws Exception {
  41         int i = 0;
  42         if (flag) {
  43             try {
  44                 throw exception;
  45             } catch(Exception e) {
  46                 array[i] = 0;
  47                 i++;
  48             }
  49         }
  50         if (i < 10) {
  51             throw exception; // caught by exception handler above as well
  52         }
  53     }
  54 */
  55 public static Method test:"(Z[ILjava/lang/Exception;)V"
  56         throws java/lang/Exception
  57         stack 3 locals 5
  58 {
  59                 iconst_0;
  60                 istore_3;
  61                 iload_0;
  62                 ifeq    L17;
  63                 try t0;
  64                 aload_2;
  65                 athrow;
  66                 endtry t0;
  67                 catch t0 java/lang/Exception;
  68                 catch t1 java/lang/Exception;
  69                 stack_frame_type full;
  70                 locals_map int, class "[I", class java/lang/Exception, int;
  71                 stack_map class java/lang/Exception;
  72                 astore  4;
  73                 aload_1;
  74                 iload_3;
  75                 iconst_0;
  76                 iastore;
  77                 iinc    3, 1;
  78         L17:    stack_frame_type same;
  79                 iload_3;
  80                 bipush  10;
  81                 if_icmpge       L25;
  82                 try t1;
  83                 aload_2;
  84                 athrow;
  85                 endtry t1;
  86         L25:    stack_frame_type same;
  87                 return;
  88 }
  89 } // end Class TestRangeCheckExceptionHandlerLoop