30114
|
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 |
/*
|
|
26 |
* This class should throw VerifyError because the StackMap for bytecode index
|
|
27 |
* 9 (dstore_2, line 60) is incorrect. The stack maps for bytecode indexes 9
|
|
28 |
* and 18 (astore_2, line 70) do not match because 9 does not supply enough
|
|
29 |
* locals to satisfy 18.
|
|
30 |
*
|
|
31 |
* The dstore_2 bytecode at bytecode index 9 changes the type state,
|
|
32 |
* preventing the stackmap mismatch. But, if the incoming type state is used,
|
|
33 |
* as required by JVM Spec 8, then the verifier will detected the stackmap
|
|
34 |
* mismatch, and throw VerifyError.
|
|
35 |
*/
|
|
36 |
|
|
37 |
super public class BadMapDstore
|
|
38 |
version 51:0
|
|
39 |
{
|
|
40 |
|
|
41 |
Field blah:I;
|
|
42 |
|
|
43 |
public Method "<init>":"()V"
|
|
44 |
stack 1 locals 1
|
|
45 |
{
|
|
46 |
aload_0;
|
|
47 |
invokespecial Method java/lang/Object."<init>":"()V";
|
|
48 |
return;
|
|
49 |
}
|
|
50 |
|
|
51 |
public static Method main:"([Ljava/lang/String;)V"
|
|
52 |
stack 4 locals 4
|
|
53 |
{
|
|
54 |
new class BadMapDstore;
|
|
55 |
dup;
|
|
56 |
invokespecial Method "<init>":"()V";
|
|
57 |
astore_1;
|
|
58 |
dconst_1;
|
|
59 |
try t0;
|
|
60 |
dstore_2;
|
|
61 |
aload_1;
|
|
62 |
iconst_5;
|
|
63 |
putfield Field blah:"I";
|
|
64 |
endtry t0;
|
|
65 |
goto L22;
|
|
66 |
catch t0 java/lang/Throwable;
|
|
67 |
stack_frame_type full;
|
|
68 |
locals_map class "[Ljava/lang/String;", class BadMapDstore, double;
|
|
69 |
stack_map class java/lang/Throwable;
|
|
70 |
astore_2;
|
|
71 |
aload_1;
|
|
72 |
dconst_0;
|
|
73 |
dstore_2;
|
|
74 |
pop;
|
|
75 |
L22: stack_frame_type same;
|
|
76 |
return;
|
|
77 |
}
|
|
78 |
|
|
79 |
} // end Class BadMapDstore
|