|
1 /* |
|
2 * Copyright (c) 2016, 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 super public class MonitorMismatchHelper |
|
25 version 52:0 |
|
26 { |
|
27 |
|
28 private Field c:I; |
|
29 |
|
30 public Method "<init>":"()V" |
|
31 stack 2 locals 1 |
|
32 { |
|
33 aload_0; |
|
34 invokespecial Method java/lang/Object."<init>":"()V"; |
|
35 aload_0; |
|
36 iconst_0; |
|
37 putfield Field c:"I"; |
|
38 return; |
|
39 } |
|
40 |
|
41 public synchronized Method increment:"()V" |
|
42 stack 3 locals 1 |
|
43 { |
|
44 aload_0; |
|
45 dup; |
|
46 getfield Field c:"I"; |
|
47 iconst_1; |
|
48 iadd; |
|
49 putfield Field c:"I"; |
|
50 return; |
|
51 } |
|
52 |
|
53 public synchronized Method decrement:"()V" |
|
54 stack 3 locals 1 |
|
55 { |
|
56 aload_0; |
|
57 dup; |
|
58 getfield Field c:"I"; |
|
59 iconst_1; |
|
60 isub; |
|
61 putfield Field c:"I"; |
|
62 return; |
|
63 } |
|
64 |
|
65 public synchronized Method value:"()I" |
|
66 stack 1 locals 1 |
|
67 { |
|
68 aload_0; |
|
69 getfield Field c:"I"; |
|
70 ireturn; |
|
71 } |
|
72 |
|
73 public static varargs Method main:"([Ljava/lang/String;)V" |
|
74 stack 2 locals 4 |
|
75 { |
|
76 new class MonitorMismatchHelper; |
|
77 dup; |
|
78 invokespecial Method "<init>":"()V"; |
|
79 astore_1; |
|
80 aload_1; |
|
81 dup; |
|
82 astore_2; |
|
83 monitorenter; |
|
84 try t0; |
|
85 aload_1; |
|
86 invokevirtual Method increment:"()V"; |
|
87 aload_1; |
|
88 invokevirtual Method increment:"()V"; |
|
89 aload_1; |
|
90 invokevirtual Method decrement:"()V"; |
|
91 getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; |
|
92 aload_1; |
|
93 invokevirtual Method value:"()I"; |
|
94 invokevirtual Method java/io/PrintStream.print:"(I)V"; |
|
95 aload_2; |
|
96 monitorexit; |
|
97 endtry t0; |
|
98 goto L44; |
|
99 catch t0 #0; |
|
100 catch t1 #0; |
|
101 try t1; |
|
102 stack_frame_type full; |
|
103 locals_map class "[Ljava/lang/String;", class MonitorMismatchHelper, class java/lang/Object; |
|
104 stack_map class java/lang/Throwable; |
|
105 astore_3; |
|
106 aload_2; |
|
107 endtry t1; |
|
108 aload_3; |
|
109 athrow; |
|
110 L44: stack_frame_type chop1; |
|
111 return; |
|
112 } |
|
113 |
|
114 } // end Class MonitorMismatchHelper |