Search in sources :

Example 6 with OptionKey

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

the class GraalOSRLockTest method testLockOSRRecursive.

@Test
@SuppressWarnings("try")
public void testLockOSRRecursive() {
    run(() -> {
        // call it
        testRecursiveLockingLeaf();
        ResolvedJavaMethod leaf = getResolvedJavaMethod("testRecursiveLockingLeaf");
        // profile it
        leaf.reprofile();
        testRecursiveLockingLeaf();
        EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
        overrides.put(HighTier.Options.Inline, false);
        OptionValues options = new OptionValues(getInitialOptions(), overrides);
        DebugContext debug = getDebugContext(options);
        compile(debug, leaf, -1);
        testOSR(options, "testRecursiveLockingRoot");
    });
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) DebugContext(org.graalvm.compiler.debug.DebugContext) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) Test(org.junit.Test)

Example 7 with OptionKey

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

the class GraalOSRLockTest method testLockOSRRecursiveLeafOSR.

@Test
@SuppressWarnings("try")
public void testLockOSRRecursiveLeafOSR() {
    run(() -> {
        testRecursiveRootNoOSR();
        ResolvedJavaMethod root = getResolvedJavaMethod("testRecursiveRootNoOSR");
        EconomicMap<OptionKey<?>, Object> overrides = osrLockNoDeopt();
        overrides.put(HighTier.Options.Inline, false);
        OptionValues options = new OptionValues(getInitialOptions(), overrides);
        DebugContext debug = getDebugContext(options);
        compile(debug, root, -1);
        testOSR(options, "testRecursiveLeafOSR");
        // force a safepoint and hope the inflated locks are deflated
        System.gc();
        // call the root to call into the leaf and enter the osr-ed code
        testRecursiveRootNoOSR();
    });
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) DebugContext(org.graalvm.compiler.debug.DebugContext) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) Test(org.junit.Test)

Example 8 with OptionKey

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

the class CompileTheWorld method loadOptions.

public static OptionValues loadOptions(OptionValues initialValues) {
    EconomicMap<OptionKey<?>, Object> values = OptionValues.newOptionMap();
    List<OptionDescriptors> loader = singletonList(DESCRIPTORS);
    OptionsParser.parseOptions(extractEntries(System.getProperties(), "CompileTheWorld.", true), values, loader);
    OptionValues options = new OptionValues(initialValues, values);
    if (Options.Help.getValue(options)) {
        options.printHelp(loader, System.out, "CompileTheWorld.");
        System.exit(0);
    }
    return options;
}
Also used : OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) ReflectionOptionDescriptors(org.graalvm.compiler.core.test.ReflectionOptionDescriptors) OptionDescriptors(org.graalvm.compiler.options.OptionDescriptors)

Example 9 with OptionKey

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

the class DumpPathTest method testDump.

@Test
public void testDump() throws IOException {
    Path dumpDirectoryPath = Files.createTempDirectory("DumpPathTest");
    String[] extensions = new String[] { ".cfg", ".bgv", ".graph-strings" };
    EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
    overrides.put(DebugOptions.DumpPath, dumpDirectoryPath.toString());
    overrides.put(DebugOptions.PrintGraphFile, true);
    overrides.put(DebugOptions.PrintCanonicalGraphStrings, true);
    overrides.put(DebugOptions.Dump, "*");
    // Generate dump files.
    test(new OptionValues(getInitialOptions(), overrides), "snippet");
    // Check that Ideal files got created, in the right place.
    checkForFiles(dumpDirectoryPath, extensions);
    // Clean up the generated files.
    scrubDirectory(dumpDirectoryPath);
}
Also used : Path(java.nio.file.Path) OptionValues(org.graalvm.compiler.options.OptionValues) OptionKey(org.graalvm.compiler.options.OptionKey) Test(org.junit.Test)

Example 10 with OptionKey

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

the class RuntimeOptionFeature method collectOptionKeys.

private Object collectOptionKeys(Object obj) {
    if (obj instanceof OptionKey) {
        OptionKey<?> optionKey = (OptionKey<?>) obj;
        if (!(optionKey instanceof HostedOptionKey)) {
            OptionDescriptor optionDescriptor = optionKey.getDescriptor();
            if (optionDescriptor == null) {
                throw VMError.shouldNotReachHere("No OptionDescriptor registered for an OptionKey. Often that is the result of an incomplete build. " + "The registration code is generated by an annotation processor at build time, so a clean and full rebuild often helps to solve this problem");
            }
            reachableOptions.put(optionDescriptor, true);
        }
    }
    return obj;
}
Also used : HostedOptionKey(com.oracle.svm.core.option.HostedOptionKey) OptionDescriptor(org.graalvm.compiler.options.OptionDescriptor) OptionKey(org.graalvm.compiler.options.OptionKey) HostedOptionKey(com.oracle.svm.core.option.HostedOptionKey)

Aggregations

OptionKey (org.graalvm.compiler.options.OptionKey)17 OptionValues (org.graalvm.compiler.options.OptionValues)15 Test (org.junit.Test)13 DebugContext (org.graalvm.compiler.debug.DebugContext)8 IOException (java.io.IOException)4 Scope (org.graalvm.compiler.debug.DebugContext.Scope)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintStream (java.io.PrintStream)3 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)2 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)2 OptionDescriptors (org.graalvm.compiler.options.OptionDescriptors)2 HostedOptionKey (com.oracle.svm.core.option.HostedOptionKey)1 File (java.io.File)1 FileReader (java.io.FileReader)1 Field (java.lang.reflect.Field)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 Type (java.lang.reflect.Type)1 Path (java.nio.file.Path)1 Map (java.util.Map)1 Properties (java.util.Properties)1