hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java
author rschatz
Thu, 16 Jun 2016 16:41:50 +0000
changeset 39423 0f8dc3693499
parent 38027 8a5693d27400
child 39450 78e99b030d5f
permissions -rw-r--r--
8159167: [JVMCI] fix HotSpotVMConfig startup performance Reviewed-by: iveresov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     1
/*
38027
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36508
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     4
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     8
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    13
 * accompanied this code).
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    14
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    18
 *
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    21
 * questions.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    22
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    23
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    24
/**
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    25
 * @test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    26
 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    27
 * @library /
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    28
 * @modules jdk.vm.ci/jdk.vm.ci.hotspot
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    29
 *          jdk.vm.ci/jdk.vm.ci.meta
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    30
 *          jdk.vm.ci/jdk.vm.ci.code
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    31
 *          jdk.vm.ci/jdk.vm.ci.code.site
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    32
 *          jdk.vm.ci/jdk.vm.ci.runtime
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    33
 *          jdk.vm.ci/jdk.vm.ci.amd64
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35137
diff changeset
    34
 *          jdk.vm.ci/jdk.vm.ci.sparc
39423
0f8dc3693499 8159167: [JVMCI] fix HotSpotVMConfig startup performance
rschatz
parents: 38027
diff changeset
    35
 * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java TestHotSpotVMConfig.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java
38027
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36508
diff changeset
    36
 * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleCodeInstallationTest
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    37
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    38
38027
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36508
diff changeset
    39
package jdk.vm.ci.code.test;
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36508
diff changeset
    40
8a5693d27400 8153439: do not install an empty SpeculationLog in an nmethod
dnsimon
parents: 36508
diff changeset
    41
import org.junit.Test;
35137
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    42
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    43
import jdk.vm.ci.code.Register;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    44
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    45
/**
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    46
 * Test simple code installation.
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    47
 */
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    48
public class SimpleCodeInstallationTest extends CodeInstallationTest {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    49
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    50
    public static int add(int a, int b) {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    51
        return a + b;
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    52
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    53
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    54
    private static void compileAdd(TestAssembler asm) {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    55
        Register arg0 = asm.emitIntArg0();
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    56
        Register arg1 = asm.emitIntArg1();
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    57
        Register ret = asm.emitIntAdd(arg0, arg1);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    58
        asm.emitIntRet(ret);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    59
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    60
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    61
    @Test
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    62
    public void test() {
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    63
        test(SimpleCodeInstallationTest::compileAdd, getMethod("add", int.class, int.class), 5, 7);
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    64
    }
c8f8f6de68a7 8144704: [JVMCI] add tests for simple code installation
rschatz
parents:
diff changeset
    65
}