hotspot/test/runtime/logging/BadMap50.jasm
changeset 34628 6d08ec72803b
equal deleted inserted replaced
34147:8726d73d17fb 34628:6d08ec72803b
       
     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  * This class should throw VerifyError because the StackMap for bytecode
       
    26  * index 45 is incorrect. The stack maps for bytecode indexes 45 and 49 are
       
    27  * incompatible because 45 doesn't supply enough locals to satisfy 49.
       
    28  *
       
    29  * The astore_2 bytecode at bytecode index 45 changes the type state,
       
    30  * preventing the stackmap mismatch.  But, if the incoming type state is used,
       
    31  * as required by JVM Spec 8, then the verifier will detected the stackmap
       
    32  * mismatch, and throw VerifyError.
       
    33  */
       
    34 
       
    35 super public class BadMap50
       
    36     version 50:0
       
    37 {
       
    38 
       
    39 
       
    40 public Method "<init>":"()V"
       
    41     stack 1 locals 1
       
    42 {
       
    43         aload_0;
       
    44         invokespecial    Method java/lang/Object."<init>":"()V";
       
    45         return;
       
    46 }
       
    47 
       
    48 public static Method main:"([Ljava/lang/String;)V"
       
    49     throws java/lang/Throwable
       
    50     stack 0 locals 1
       
    51 {
       
    52         return;
       
    53 }
       
    54 
       
    55 public static Method foo:"()V"
       
    56     stack 3 locals 5
       
    57 {
       
    58         iconst_0;
       
    59         ifne    L5;
       
    60         nop;
       
    61         try t7;
       
    62     L5:    stack_frame_type full;
       
    63         aconst_null;
       
    64         astore_0;
       
    65         iconst_3;
       
    66         istore_1;
       
    67         try t0;
       
    68         aconst_null;
       
    69         astore_0;
       
    70         endtry t0;
       
    71         goto    L19;
       
    72         catch t0 java/io/IOException;
       
    73         stack_frame_type full;
       
    74         locals_map class java/lang/Object, int;
       
    75         stack_map class java/io/IOException;
       
    76         astore_2;
       
    77         aconst_null;
       
    78         astore_0;
       
    79         iconst_2;
       
    80         istore_1;
       
    81         try t1;
       
    82     L19:    stack_frame_type full;
       
    83         locals_map class java/lang/Object, int;
       
    84         iconst_0;
       
    85         istore_2;
       
    86         endtry t1;
       
    87         iload_1;
       
    88         ifeq    L37;
       
    89         nop;
       
    90         goto    L37;
       
    91         catch t1 #0;
       
    92         catch t2 #0;
       
    93         try t2;
       
    94         stack_frame_type full;
       
    95         locals_map class java/lang/Object, int;
       
    96         stack_map class java/lang/Throwable;
       
    97 astore_3;
       
    98 iconst_2;
       
    99 istore_2;
       
   100         endtry t2;
       
   101         iload_1;
       
   102         ifeq    L35;
       
   103         nop;
       
   104     L35:    stack_frame_type full;
       
   105         locals_map class java/lang/Object, int, bogus, class java/lang/Throwable;
       
   106 aload_3;
       
   107         athrow;
       
   108         try t3, t4;
       
   109     L37:    stack_frame_type full;
       
   110         locals_map class java/lang/Object, int, int;
       
   111         iload_2;
       
   112         ifeq    L42;
       
   113         nop;
       
   114         endtry t3, t4;
       
   115     L42:    stack_frame_type full;
       
   116         locals_map class java/lang/Object, int, int;
       
   117         goto    L54;
       
   118         catch t3 java/lang/Exception;
       
   119         try t5;
       
   120         stack_frame_type full;
       
   121         locals_map class java/lang/Object, int;
       
   122         stack_map class java/lang/Exception;
       
   123         // astore_2;                  // astore_2, at bci 45, that changes the type state.
       
   124 // pop;
       
   125 iconst_1;
       
   126         istore_2;                  // astore_2, at bci 45, that changes the type state.
       
   127         endtry t5;
       
   128         goto    L54;
       
   129         catch t4 #0;
       
   130         catch t5 #0;
       
   131         catch t6 #0;
       
   132         try t6;
       
   133       stack_frame_type full;
       
   134       locals_map class java/lang/Object, int, int;
       
   135       stack_map class java/lang/Throwable;
       
   136 // astore    3;
       
   137  istore_1;
       
   138         endtry t6;
       
   139 // aload    3;
       
   140 //         athrow;
       
   141     L54:    stack_frame_type full;
       
   142         locals_map class java/lang/Object, int, int;
       
   143         goto    L57;
       
   144     L57:    stack_frame_type full;
       
   145         locals_map class java/lang/Object, int, int;
       
   146         nop;
       
   147         endtry t7;
       
   148         return;
       
   149         catch t7 #0;
       
   150         stack_frame_type full;
       
   151         stack_map class java/lang/Throwable;
       
   152         nop;
       
   153         athrow;
       
   154 }
       
   155 
       
   156 } // end Class BadMap50