Search in sources :

Example 6 with HotSpotInstalledCode

use of jdk.vm.ci.hotspot.HotSpotInstalledCode in project graal by oracle.

the class CompressedOopTest method test17.

@Test
public void test17() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringFormat");
    installedBenchmarkCode.executeVarargs();
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 7 with HotSpotInstalledCode

use of jdk.vm.ci.hotspot.HotSpotInstalledCode in project graal by oracle.

the class CompressedOopTest method test3.

@Test
public void test3() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("compareAndSwapTest", Object.class, Object.class, Object.class);
    Object initial = new Object();
    Object replacement = new Object();
    AtomicReference<Object> cas = new AtomicReference<>();
    Assert.assertEquals(cas.get(), null);
    installedBenchmarkCode.executeVarargs(cas, null, initial);
    Assert.assertEquals(cas.get(), initial);
    installedBenchmarkCode.executeVarargs(cas, initial, replacement);
    Assert.assertEquals(cas.get(), replacement);
}
Also used : AtomicReference(java.util.concurrent.atomic.AtomicReference) HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 8 with HotSpotInstalledCode

use of jdk.vm.ci.hotspot.HotSpotInstalledCode in project graal by oracle.

the class CompressedOopTest method test.

@Test
public void test() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("fieldTest", Object.class);
    Container c1 = new Container();
    Assert.assertEquals(c1.b, installedBenchmarkCode.executeVarargs(c1));
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 9 with HotSpotInstalledCode

use of jdk.vm.ci.hotspot.HotSpotInstalledCode in project graal by oracle.

the class CompressedOopTest method test13.

@Test
public void test13() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("unmodListTestByte", Object.class);
    List<Byte> list = new ArrayList<>();
    Byte[] array = (Byte[]) installedBenchmarkCode.executeVarargs(list);
    Assert.assertTrue(list.size() == array.length);
}
Also used : ArrayList(java.util.ArrayList) HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 10 with HotSpotInstalledCode

use of jdk.vm.ci.hotspot.HotSpotInstalledCode in project graal by oracle.

the class CompileTheWorld method compileMethod.

/**
 * Compiles a method and gathers some statistics.
 */
private void compileMethod(HotSpotResolvedJavaMethod method, int counter) {
    try {
        long start = System.currentTimeMillis();
        long allocatedAtStart = getCurrentThreadAllocatedBytes();
        int entryBCI = JVMCICompiler.INVOCATION_ENTRY_BCI;
        HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, 0L);
        // For more stable CTW execution, disable use of profiling information
        boolean useProfilingInfo = false;
        boolean installAsDefault = false;
        CompilationTask task = new CompilationTask(jvmciRuntime, compiler, request, useProfilingInfo, installAsDefault, currentOptions);
        task.runCompilation();
        // Invalidate the generated code so the code cache doesn't fill up
        HotSpotInstalledCode installedCode = task.getInstalledCode();
        if (installedCode != null) {
            installedCode.invalidate();
        }
        memoryUsed.getAndAdd(getCurrentThreadAllocatedBytes() - allocatedAtStart);
        compileTime.getAndAdd(System.currentTimeMillis() - start);
        compiledMethodsCounter.incrementAndGet();
    } catch (Throwable t) {
        // Catch everything and print a message
        println("CompileTheWorld (%d) : Error compiling method: %s", counter, method.format("%H.%n(%p):%r"));
        printStackTrace(t);
    }
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) HotSpotCompilationRequest(jdk.vm.ci.hotspot.HotSpotCompilationRequest) Print(org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print) CompilationTask(org.graalvm.compiler.hotspot.CompilationTask)

Aggregations

HotSpotInstalledCode (jdk.vm.ci.hotspot.HotSpotInstalledCode)24 GraalCompilerTest (org.graalvm.compiler.core.test.GraalCompilerTest)19 Test (org.junit.Test)19 ArrayList (java.util.ArrayList)3 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)3 Unsafe (sun.misc.Unsafe)2 ArrayDeque (java.util.ArrayDeque)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 HotSpotCompilationRequest (jdk.vm.ci.hotspot.HotSpotCompilationRequest)1 Print (org.graalvm.compiler.core.CompilationWrapper.ExceptionAction.Print)1 CompilationTask (org.graalvm.compiler.hotspot.CompilationTask)1