BC_monitorenter.java revision 12651:6ef01bd40ce2
1108684Sphk/*
2108684Sphk * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3108684Sphk * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4108684Sphk *
5108684Sphk * This code is free software; you can redistribute it and/or modify it
6108684Sphk * under the terms of the GNU General Public License version 2 only, as
7108684Sphk * published by the Free Software Foundation.
8108684Sphk *
9108684Sphk * This code is distributed in the hope that it will be useful, but WITHOUT
10108684Sphk * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11108684Sphk * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12108684Sphk * version 2 for more details (a copy is included in the LICENSE file that
13108684Sphk * accompanied this code).
14108684Sphk *
15108684Sphk * You should have received a copy of the GNU General Public License version
16108684Sphk * 2 along with this work; if not, write to the Free Software Foundation,
17108684Sphk * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18108684Sphk *
19108684Sphk * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20108684Sphk * or visit www.oracle.com if you need additional information or have any
21108684Sphk * questions.
22108684Sphk */
23108684Sphkpackage org.graalvm.compiler.jtt.bytecode;
24108684Sphk
25108684Sphkimport org.junit.Test;
26108684Sphk
27108684Sphkimport org.graalvm.compiler.jtt.JTTTest;
28108684Sphk
29108684Sphk/*
30108684Sphk */
31108684Sphkpublic class BC_monitorenter extends JTTTest {
32164672Syar
33164672Syar    static DummyTestClass object = new DummyTestClass();
34108684Sphk
35108684Sphk    public static int test(int arg) {
36108684Sphk        synchronized (object) {
37164672Syar            return arg;
38164672Syar        }
39164672Syar    }
40164672Syar
41164672Syar    @Test
42108684Sphk    public void run0() throws Throwable {
43164672Syar        runTest("test", 0);
44164672Syar    }
45164672Syar
46164672Syar    @Test
47108684Sphk    public void run1() throws Throwable {
48164672Syar        runTest("test", 1);
49108684Sphk    }
50108684Sphk
51164637Syar    @Test
52108684Sphk    public void run2() throws Throwable {
53164671Syar        runTest("test", -2);
54108684Sphk    }
55164671Syar
56164671Syar}
57108684Sphk