Search in sources :

Example 21 with HotSpotInstalledCode

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

the class CompressedOopTest method test6.

@Test
public void test6() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringCopyTest", Object.class, Object.class);
    String a = new String("Test ");
    String b = new String("String");
    String c = (String) installedBenchmarkCode.executeVarargs(a, b);
    Assert.assertTrue(c.equals("Test String"));
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 22 with HotSpotInstalledCode

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

the class CompressedOopTest method test1.

@Test
public void test1() throws Exception {
    HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("arrayTest", Object.class, Object.class, Object.class);
    ArrayContainer ac = new ArrayContainer();
    Assert.assertEquals(ac.a[9], installedBenchmarkCode.executeVarargs(ac.a, 0, 9));
    Assert.assertEquals(ac.a[8], installedBenchmarkCode.executeVarargs(ac.a, 1, 8));
    Assert.assertEquals(ac.a[7], installedBenchmarkCode.executeVarargs(ac.a, 2, 7));
    Assert.assertEquals(ac.a[6], installedBenchmarkCode.executeVarargs(ac.a, 3, 6));
    Assert.assertEquals(ac.a[5], installedBenchmarkCode.executeVarargs(ac.a, 4, 5));
    Assert.assertEquals(ac.a[4], installedBenchmarkCode.executeVarargs(ac.a, 5, 4));
    Assert.assertEquals(ac.a[3], installedBenchmarkCode.executeVarargs(ac.a, 6, 3));
    Assert.assertEquals(ac.a[2], installedBenchmarkCode.executeVarargs(ac.a, 7, 2));
    Assert.assertEquals(ac.a[1], installedBenchmarkCode.executeVarargs(ac.a, 8, 1));
    Assert.assertEquals(ac.a[0], installedBenchmarkCode.executeVarargs(ac.a, 9, 0));
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 23 with HotSpotInstalledCode

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

the class InstalledCodeExecuteHelperTest method test1.

@Test
public void test1() throws InvalidInstalledCodeException {
    final ResolvedJavaMethod fooMethod = getResolvedJavaMethod("foo");
    final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooMethod);
    argsToBind = new Object[] { fooCode };
    final ResolvedJavaMethod benchmarkMethod = getResolvedJavaMethod("benchmark");
    final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(benchmarkMethod);
    Assert.assertEquals(Integer.valueOf(42), benchmark(fooCode));
    Assert.assertEquals(Integer.valueOf(42), installedBenchmarkCode.executeVarargs(argsToBind[0]));
}
Also used : HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) Test(org.junit.Test) GraalCompilerTest(org.graalvm.compiler.core.test.GraalCompilerTest)

Example 24 with HotSpotInstalledCode

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

the class WriteBarrierAdditionTest method getInstalledCode.

private HotSpotInstalledCode getInstalledCode(String name, boolean withUnsafePrefix) throws Exception {
    final ResolvedJavaMethod javaMethod = withUnsafePrefix ? getResolvedJavaMethod(WriteBarrierAdditionTest.class, name, Unsafe.class, Object.class, Object.class, Object.class) : getResolvedJavaMethod(WriteBarrierAdditionTest.class, name, Object.class, Object.class, Object.class);
    final HotSpotInstalledCode installedCode = (HotSpotInstalledCode) getCode(javaMethod);
    return installedCode;
}
Also used : Unsafe(sun.misc.Unsafe) HotSpotInstalledCode(jdk.vm.ci.hotspot.HotSpotInstalledCode) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

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