Search in sources :

Example 16 with HotSpotInstalledCode

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

the class CompressedOopTest method getInstalledCode.

private HotSpotInstalledCode getInstalledCode(String name, Class<?>... parameterTypes) throws Exception {
    final ResolvedJavaMethod javaMethod = getResolvedJavaMethod(getClass(), name, parameterTypes);
    final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod);
    return installedBenchmarkCode;
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 17 with HotSpotInstalledCode

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

the class CompressedOopTest method test9.

@Test
public void test9() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("unmodListTest", Object.class);
    List<Object> list = new ArrayList<>();
    Object[] array = (Object[]) 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 18 with HotSpotInstalledCode

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

the class CompressedOopTest method test7.

@Test
public void test7() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("queueTest", Object.class, Object.class);
    ArrayDeque<Object> q = new ArrayDeque<>();
    Object[] objects = new Object[512];
    for (int i = 0; i < objects.length; i++) {
        objects[i] = new Object();
    }
    int j = 0;
    while (j < objects.length) {
        if (!installedBenchmarkCode.isValid()) {
            // This can get invalidated due to lack of MDO update
            installedBenchmarkCode = getInstalledCode("queueTest", Object.class, Object.class);
        }
        installedBenchmarkCode.executeVarargs(q, objects[j]);
        j++;
    }
    System.gc();
    Assert.assertTrue(q.size() == objects.length);
    Assert.assertTrue(!q.isEmpty());
    j = 0;
    while (j < objects.length) {
        Assert.assertTrue(objects[j] == q.remove());
        j++;
    }
    Assert.assertTrue(q.size() == 0);
    Assert.assertTrue(q.isEmpty());
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) ArrayDeque(java.util.ArrayDeque) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 19 with HotSpotInstalledCode

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

the class CompressedOopTest method test16.

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

Example 20 with HotSpotInstalledCode

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

the class CompressedOopTest method test4.

@Test
public void test4() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("charArrayCopyTest", Object.class, Object.class, Object.class);
    StringContainer1 source1 = new StringContainer1();
    StringContainer2 source2 = new StringContainer2();
    char[] result = new char[source1.value.length + source2.value.length];
    installedBenchmarkCode.executeVarargs(source1.value, source2.value, result);
    Assert.assertArrayEquals(new char[] { 'T', 'e', 's', 't', ' ', 'S', 't', 'r', 'i', 'n', 'g' }, result);
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

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