BC_lastore.java revision 12657:6ef01bd40ce2
1351282Sdim/*
2351282Sdim * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3351282Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4351282Sdim *
5351282Sdim * This code is free software; you can redistribute it and/or modify it
6351282Sdim * under the terms of the GNU General Public License version 2 only, as
7351282Sdim * published by the Free Software Foundation.
8351282Sdim *
9351282Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10351282Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11351282Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12351282Sdim * version 2 for more details (a copy is included in the LICENSE file that
13351282Sdim * accompanied this code).
14351282Sdim *
15351282Sdim * You should have received a copy of the GNU General Public License version
16351282Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17351282Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18351282Sdim *
19351282Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20351282Sdim * or visit www.oracle.com if you need additional information or have any
21351282Sdim * questions.
22351282Sdim */
23351282Sdimpackage org.graalvm.compiler.jtt.bytecode;
24351282Sdim
25351282Sdimimport org.junit.Test;
26351282Sdim
27351282Sdimimport org.graalvm.compiler.jtt.JTTTest;
28351282Sdim
29351282Sdim/*
30351282Sdim */
31351282Sdimpublic class BC_lastore extends JTTTest {
32351282Sdim
33351282Sdim    static long[] array = {0, 0, 0, 0};
34351282Sdim
35351282Sdim    public static long test(int arg, long val) {
36351282Sdim        final long[] array2 = arg == -2 ? null : BC_lastore.array;
37351282Sdim        array2[arg] = val;
38351282Sdim        return array2[arg];
39351282Sdim    }
40351282Sdim
41351282Sdim    @Test
42351282Sdim    public void run0() throws Throwable {
43351282Sdim        runTest("test", 0, 0L);
44351282Sdim    }
45351282Sdim
46351282Sdim    @Test
47351282Sdim    public void run1() throws Throwable {
48351282Sdim        runTest("test", 1, -1L);
49351282Sdim    }
50351282Sdim
51351282Sdim    @Test
52351282Sdim    public void run2() throws Throwable {
53351282Sdim        runTest("test", 2, 11L);
54351282Sdim    }
55351282Sdim
56351282Sdim    @Test
57351282Sdim    public void run3() throws Throwable {
58351282Sdim        runTest("test", 3, -14L);
59351282Sdim    }
60351282Sdim
61351282Sdim}
62351282Sdim