test/runtime/stackMapCheck/BadMap.jasm

Mon, 06 Nov 2017 16:51:47 +0800

author
aoqi
date
Mon, 06 Nov 2017 16:51:47 +0800
changeset 7997
6cbff0651f1a
parent 7666
6b65121b3258
permissions
-rw-r--r--

[Code Reorganization] remove trailing whitespace to pass jcheck test

hseigel@7666 1 /*
hseigel@7666 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
hseigel@7666 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hseigel@7666 4 *
hseigel@7666 5 * This code is free software; you can redistribute it and/or modify it
hseigel@7666 6 * under the terms of the GNU General Public License version 2 only, as
hseigel@7666 7 * published by the Free Software Foundation.
hseigel@7666 8 *
hseigel@7666 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hseigel@7666 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hseigel@7666 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hseigel@7666 12 * version 2 for more details (a copy is included in the LICENSE file that
hseigel@7666 13 * accompanied this code).
hseigel@7666 14 *
hseigel@7666 15 * You should have received a copy of the GNU General Public License version
hseigel@7666 16 * 2 along with this work; if not, write to the Free Software Foundation,
hseigel@7666 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hseigel@7666 18 *
hseigel@7666 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hseigel@7666 20 * or visit www.oracle.com if you need additional information or have any
hseigel@7666 21 * questions.
hseigel@7666 22 *
hseigel@7666 23 */
hseigel@7666 24
hseigel@7666 25 /*
hseigel@7666 26 * This class should throw VerifyError because the StackMap for bytecode index
hseigel@7666 27 * 45 (astore_2, line 123) is incorrect. The stack maps for bytecode indexes 45
hseigel@7666 28 * and 49 (astore, line 133) do not match because 45 does not supply enough
hseigel@7666 29 * locals to satisfy 49.
hseigel@7666 30 *
hseigel@7666 31 * The astore_2 bytecode at bytecode index 45 changes the type state,
hseigel@7666 32 * preventing the stackmap mismatch. But, if the incoming type state is used,
hseigel@7666 33 * as required by JVM Spec 8, then the verifier will detected the stackmap
hseigel@7666 34 * mismatch, and throw VerifyError.
hseigel@7666 35 */
hseigel@7666 36
hseigel@7666 37 super public class BadMap
hseigel@7666 38 version 51:0
hseigel@7666 39 {
hseigel@7666 40
hseigel@7666 41
hseigel@7666 42 public Method "<init>":"()V"
hseigel@7666 43 stack 1 locals 1
hseigel@7666 44 {
hseigel@7666 45 aload_0;
hseigel@7666 46 invokespecial Method java/lang/Object."<init>":"()V";
hseigel@7666 47 return;
hseigel@7666 48 }
hseigel@7666 49
hseigel@7666 50 public static Method main:"([Ljava/lang/String;)V"
hseigel@7666 51 throws java/lang/Throwable
hseigel@7666 52 stack 0 locals 1
hseigel@7666 53 {
hseigel@7666 54 return;
hseigel@7666 55 }
hseigel@7666 56
hseigel@7666 57 public static Method foo:"()V"
hseigel@7666 58 stack 3 locals 5
hseigel@7666 59 {
hseigel@7666 60 iconst_0;
hseigel@7666 61 ifne L5;
hseigel@7666 62 nop;
hseigel@7666 63 try t7;
hseigel@7666 64 L5: stack_frame_type full;
hseigel@7666 65 aconst_null;
hseigel@7666 66 dup;
hseigel@7666 67 astore_0;
hseigel@7666 68 astore_1;
hseigel@7666 69 try t0;
hseigel@7666 70 aconst_null;
hseigel@7666 71 astore_0;
hseigel@7666 72 endtry t0;
hseigel@7666 73 goto L19;
hseigel@7666 74 catch t0 java/io/IOException;
hseigel@7666 75 stack_frame_type full;
hseigel@7666 76 locals_map class java/lang/Object, null;
hseigel@7666 77 stack_map class java/io/IOException;
hseigel@7666 78 astore_2;
hseigel@7666 79 aconst_null;
hseigel@7666 80 dup;
hseigel@7666 81 astore_1;
hseigel@7666 82 astore_0;
hseigel@7666 83 try t1;
hseigel@7666 84 L19: stack_frame_type full;
hseigel@7666 85 locals_map class java/lang/Object, class java/lang/Object;
hseigel@7666 86 aconst_null;
hseigel@7666 87 astore_2;
hseigel@7666 88 endtry t1;
hseigel@7666 89 aload_1;
hseigel@7666 90 ifnonnull L37;
hseigel@7666 91 nop;
hseigel@7666 92 goto L37;
hseigel@7666 93 catch t1 #0;
hseigel@7666 94 catch t2 #0;
hseigel@7666 95 try t2;
hseigel@7666 96 stack_frame_type full;
hseigel@7666 97 locals_map class java/lang/Object, class java/lang/Object;
hseigel@7666 98 stack_map class java/lang/Throwable;
hseigel@7666 99 astore_3;
hseigel@7666 100 endtry t2;
hseigel@7666 101 aload_1;
hseigel@7666 102 ifnonnull L35;
hseigel@7666 103 nop;
hseigel@7666 104 L35: stack_frame_type full;
hseigel@7666 105 locals_map class java/lang/Object, class java/lang/Object, bogus, class java/lang/Throwable;
hseigel@7666 106 aload_3;
hseigel@7666 107 athrow;
hseigel@7666 108 try t3, t4;
hseigel@7666 109 L37: stack_frame_type full;
hseigel@7666 110 locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
hseigel@7666 111 aload_1;
hseigel@7666 112 ifnonnull L42;
hseigel@7666 113 nop;
hseigel@7666 114 endtry t3, t4;
hseigel@7666 115 L42: stack_frame_type full;
hseigel@7666 116 locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
hseigel@7666 117 goto L54;
hseigel@7666 118 catch t3 java/lang/Exception;
hseigel@7666 119 try t5;
hseigel@7666 120 stack_frame_type full;
hseigel@7666 121 locals_map class java/lang/Object, class java/lang/Object;
hseigel@7666 122 stack_map class java/lang/Exception;
hseigel@7666 123 astore_2; // astore_2, at bci 45, that changes the type state.
hseigel@7666 124 endtry t5;
hseigel@7666 125 goto L54;
hseigel@7666 126 catch t4 #0;
hseigel@7666 127 catch t5 #0;
hseigel@7666 128 catch t6 #0;
hseigel@7666 129 try t6;
hseigel@7666 130 stack_frame_type full;
hseigel@7666 131 locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
hseigel@7666 132 stack_map class java/lang/Throwable;
hseigel@7666 133 astore 4;
hseigel@7666 134 endtry t6;
hseigel@7666 135 aload 4;
hseigel@7666 136 athrow;
hseigel@7666 137 L54: stack_frame_type full;
hseigel@7666 138 locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
hseigel@7666 139 goto L57;
hseigel@7666 140 L57: stack_frame_type full;
hseigel@7666 141 locals_map class java/lang/Object, class java/lang/Object, class java/lang/Object;
hseigel@7666 142 nop;
hseigel@7666 143 endtry t7;
hseigel@7666 144 return;
hseigel@7666 145 catch t7 #0;
hseigel@7666 146 stack_frame_type full;
hseigel@7666 147 stack_map class java/lang/Throwable;
hseigel@7666 148 nop;
hseigel@7666 149 athrow;
hseigel@7666 150 }
hseigel@7666 151
hseigel@7666 152 } // end Class BadMap

mercurial