src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompileTheWorldTest.java
author dlong
Tue, 24 Apr 2018 09:04:57 -0700
changeset 49873 26ebfe8ce852
parent 48861 47f19ff9903c
child 50858 2d3e99a72541
permissions -rw-r--r--
8199755: Update Graal Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     1
/*
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     4
 *
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     8
 *
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    13
 * accompanied this code).
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    14
 *
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    18
 *
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    21
 * questions.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    22
 */
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    23
package org.graalvm.compiler.hotspot.test;
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    24
46680
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    25
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationBailoutAction;
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    26
import static org.graalvm.compiler.core.GraalCompilerOptions.CompilationFailureAction;
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    27
49873
26ebfe8ce852 8199755: Update Graal
dlong
parents: 48861
diff changeset
    28
import jdk.internal.vm.compiler.collections.EconomicMap;
46680
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    29
import org.graalvm.compiler.core.CompilationWrapper.ExceptionAction;
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    30
import org.graalvm.compiler.core.test.GraalCompilerTest;
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    31
import org.graalvm.compiler.hotspot.HotSpotGraalCompiler;
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 43972
diff changeset
    32
import org.graalvm.compiler.options.OptionKey;
694c102fd8ed 8177046: Update Graal
iveresov
parents: 43972
diff changeset
    33
import org.graalvm.compiler.options.OptionValues;
694c102fd8ed 8177046: Update Graal
iveresov
parents: 43972
diff changeset
    34
import org.junit.Test;
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    35
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    36
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    37
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    38
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    39
/**
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    40
 * Tests {@link CompileTheWorld} functionality.
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    41
 */
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    42
public class CompileTheWorldTest extends GraalCompilerTest {
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    43
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    44
    @Test
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    45
    public void testJDK() throws Throwable {
46680
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    46
        ExceptionAction originalBailoutAction = CompilationBailoutAction.getValue(getInitialOptions());
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    47
        ExceptionAction originalFailureAction = CompilationFailureAction.getValue(getInitialOptions());
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    48
        // Compile a couple classes in rt.jar
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    49
        HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
46393
d497d892ab11 8178864: Update Graal
iveresov
parents: 46371
diff changeset
    50
        System.setProperty("CompileTheWorld.LimitModules", "java.base");
46344
694c102fd8ed 8177046: Update Graal
iveresov
parents: 43972
diff changeset
    51
        OptionValues initialOptions = getInitialOptions();
694c102fd8ed 8177046: Update Graal
iveresov
parents: 43972
diff changeset
    52
        EconomicMap<OptionKey<?>, Object> compilationOptions = CompileTheWorld.parseOptions("Inline=false");
46371
0337d0617e7b 8178088: Update Graal
iveresov
parents: 46344
diff changeset
    53
        new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), CompileTheWorld.SUN_BOOT_CLASS_PATH, 1, 5, null, null, false, initialOptions, compilationOptions).compile();
46680
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    54
        assert CompilationBailoutAction.getValue(initialOptions) == originalBailoutAction;
2894e4262fd6 8184768: Update Graal
iveresov
parents: 46393
diff changeset
    55
        assert CompilationFailureAction.getValue(initialOptions) == originalFailureAction;
43972
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    56
    }
1ade39b8381b 8174879: Rename jdk.vm.ci to jdk.internal.vm.ci
kvn
parents:
diff changeset
    57
}