Search in sources :

Example 1 with HotSpotInstalledCode

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

the class WriteBarrierAdditionTest method test2.

private void test2(final String snippet, Object... args) throws Exception {
    HotSpotInstalledCode code = getInstalledCode(snippet, args[0] instanceof Unsafe);
    code.executeVarargs(args);
}
Also used : Unsafe(sun.misc.Unsafe) HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode)

Example 2 with HotSpotInstalledCode

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

the class CompressedOopTest method test18.

@Test
public void test18() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBuilder");
    StringBuilder b = (StringBuilder) installedBenchmarkCode.executeVarargs();
    Assert.assertTrue(b.capacity() == 16);
    Assert.assertTrue(b.length() == 0);
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 3 with HotSpotInstalledCode

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

the class CompressedOopTest method test14.

@Test
public void test14() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringBuilderTest", Object.class, Object.class);
    StringBuilder buffer = new StringBuilder("TestTestTestTestTestTestTest");
    Assert.assertTrue(buffer.length() == 28);
    String a = new String("TestTestTestTestTestTestTest");
    installedBenchmarkCode.executeVarargs(buffer, a.toCharArray());
    Assert.assertTrue(buffer.length() == 56);
    Assert.assertTrue(buffer.toString().equals("TestTestTestTestTestTestTestTestTestTestTestTestTestTest"));
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 4 with HotSpotInstalledCode

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

the class CompressedOopTest method test5.

@Test
public void test5() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("charContainerArrayCopyTest", 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, source2, 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)

Example 5 with HotSpotInstalledCode

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

the class CompressedOopTest method test8.

@Test
public void test8() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("unmodListTest", Object.class);
    List<Object> list = new ArrayList<>();
    for (int i = 0; i < 512; i++) {
        list.add(new Object());
    }
    Object[] array = (Object[]) installedBenchmarkCode.executeVarargs(list);
    Assert.assertTrue(list.size() == array.length);
    int i = 0;
    for (Object obj : list) {
        Assert.assertTrue(obj == array[i]);
        i++;
    }
}
Also used : ArrayList(java.util.ArrayList) 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