1 /*
 2  * Copyright (c) 2022, 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  * @test
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 super public class TestUnstructuredLocking version 64:0 {
33 
34 //    Method "<init>":"()V" stack 1 locals 1 {
35 //        aload_0;
36 //        invokespecial    Method java/lang/Object."<init>":"()V";
37 //        return;
38 //    }
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         invokevirtual Method java/lang/Object.notify:"()V";
57         aload_2;
58         monitorexit;
59         return;
60     }
61 
62 }