Skip to content

Commit bcafec5

Browse files
committed
8316958: Add test for unstructured locking
Reviewed-by: dholmes, shade
1 parent 731fb4e commit bcafec5

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright Amazon.com Inc. 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+
* @test id=int
27+
* @summary Check that monitorenter A; monitorenter B; monitorexit A; monitorexit B; works
28+
* @compile TestUnstructuredLocking.jasm
29+
* @run main/othervm -Xint TestUnstructuredLocking
30+
*/
31+
/*
32+
* @test id=comp
33+
* @summary Check that monitorenter A; monitorenter B; monitorexit A; monitorexit B; works, with -Xcomp
34+
* @compile TestUnstructuredLocking.jasm
35+
* @run main/othervm -Xcomp TestUnstructuredLocking
36+
*/
37+
38+
super public class TestUnstructuredLocking version 64:0 {
39+
40+
public static Method main:"([Ljava/lang/String;)V" stack 2 locals 4 {
41+
new class java/lang/Object;
42+
dup;
43+
invokespecial Method java/lang/Object."<init>":"()V";
44+
astore_1;
45+
new class java/lang/Object;
46+
dup;
47+
invokespecial Method java/lang/Object."<init>":"()V";
48+
astore_2;
49+
aload_1;
50+
monitorenter;
51+
aload_2;
52+
monitorenter;
53+
aload_1;
54+
monitorexit;
55+
aload_2;
56+
monitorexit;
57+
return;
58+
}
59+
60+
}

0 commit comments

Comments
 (0)