Search in sources :

Example 81 with OptionValues

use of org.graalvm.compiler.options.OptionValues in project graal by oracle.

the class CompileTheWorld method main.

public static void main(String[] args) throws Throwable {
    HotSpotJVMCIRuntime jvmciRuntime = HotSpotJVMCIRuntime.runtime();
    HotSpotGraalCompiler compiler = (HotSpotGraalCompiler) jvmciRuntime.getCompiler();
    HotSpotGraalRuntimeProvider graalRuntime = compiler.getGraalRuntime();
    HotSpotCodeCacheProvider codeCache = graalRuntime.getHostProviders().getCodeCache();
    OptionValues options = loadOptions(graalRuntime.getOptions());
    int iterations = Options.Iterations.getValue(options);
    for (int i = 0; i < iterations; i++) {
        codeCache.resetCompilationStatistics();
        TTY.println("CompileTheWorld : iteration " + i);
        CompileTheWorld ctw = new CompileTheWorld(jvmciRuntime, compiler, options);
        ctw.compile();
    }
    // This is required as non-daemon threads can be started by class initializers
    System.exit(0);
}
Also used : HotSpotGraalCompiler(org.graalvm.compiler.hotspot.HotSpotGraalCompiler) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) OptionValues(org.graalvm.compiler.options.OptionValues) HotSpotJVMCIRuntime(jdk.vm.ci.hotspot.HotSpotJVMCIRuntime) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) Print(org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print)

Example 82 with OptionValues

use of org.graalvm.compiler.options.OptionValues in project graal by oracle.

the class CompileTheWorldTest method testJDK.

@Test
public void testJDK() throws Throwable {
    ExceptionAction originalBailoutAction = CompilationBailoutAction.getValue(getInitialOptions());
    ExceptionAction originalFailureAction = CompilationFailureAction.getValue(getInitialOptions());
    // Compile a couple classes in rt.jar
    HotSpotJVMCIRuntimeProvider runtime = HotSpotJVMCIRuntime.runtime();
    System.setProperty("CompileTheWorld.LimitModules", "java.base");
    OptionValues initialOptions = getInitialOptions();
    EconomicMap<OptionKey<?>, Object> compilationOptions = CompileTheWorld.parseOptions("Inline=false");
    new CompileTheWorld(runtime, (HotSpotGraalCompiler) runtime.getCompiler(), CompileTheWorld.SUN_BOOT_CLASS_PATH, 1, 5, null, null, false, initialOptions, compilationOptions).compile();
    assert CompilationBailoutAction.getValue(initialOptions) == originalBailoutAction;
    assert CompilationFailureAction.getValue(initialOptions) == originalFailureAction;
}
Also used : HotSpotGraalCompiler(org.graalvm.compiler.hotspot.HotSpotGraalCompiler) ExceptionAction(org.graalvm.compiler.core.CompilationWrapper.ExceptionAction) OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) HotSpotJVMCIRuntimeProvider(jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 83 with OptionValues

use of org.graalvm.compiler.options.OptionValues in project graal by oracle.

the class GraalOSRLockTest method testLockOSROuterInnerCompileRestOfMethod.

@Test
@SuppressWarnings("try")
public void testLockOSROuterInnerCompileRestOfMethod() {
    run(() -> {
        OptionValues options = new OptionValues(getInitialOptions(), osrLockNoDeopt());
        testOSR(options, "testOuterInnerLockCompileRestOfMethod");
    });
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) Test(org.junit.Test)

Example 84 with OptionValues

use of org.graalvm.compiler.options.OptionValues in project graal by oracle.

the class GraalOSRLockTest method testLockOSROuterCompileRestOfMethod.

@Test
@SuppressWarnings("try")
public void testLockOSROuterCompileRestOfMethod() {
    run(() -> {
        EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
        overrides.put(HighTier.Options.Inline, false);
        OptionValues options = new OptionValues(getInitialOptions(), overrides);
        testOSR(options, "testOuterLockCompileRestOfMethod");
    });
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) Test(org.junit.Test)

Example 85 with OptionValues

use of org.graalvm.compiler.options.OptionValues in project graal by oracle.

the class GraalOSRLockTest method testLockOSROuterInnerLockDepthCompileRestOfMethod.

@Test
@SuppressWarnings("try")
public void testLockOSROuterInnerLockDepthCompileRestOfMethod() {
    run(() -> {
        EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
        overrides.put(HighTier.Options.Inline, false);
        OptionValues options = new OptionValues(getInitialOptions(), overrides);
        testOSR(options, "testOuterInnerLockDepth1CompileRestOfMethod");
    });
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) Test(org.junit.Test)

Aggregations

OptionValues (org.graalvm.compiler.options.OptionValues)158 Test (org.junit.Test)65 DebugContext (org.graalvm.compiler.debug.DebugContext)50 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)36 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)30 Graph (org.graalvm.compiler.graph.Graph)22 OptionKey (org.graalvm.compiler.options.OptionKey)16 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)13 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)11 GraphBuilderConfiguration (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration)10 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)10 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)10 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)9 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)9 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)9 Providers (org.graalvm.compiler.phases.util.Providers)9 IOException (java.io.IOException)8 Method (java.lang.reflect.Method)8 CompilationResult (org.graalvm.compiler.code.CompilationResult)7 CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)7