Search in sources :

Example 1 with MemoryAccessProvider

use of jdk.vm.ci.meta.MemoryAccessProvider in project graal by oracle.

the class StampMemoryAccessTest method testReadObject.

@Ignore("not all JVMCI versions are safe yet")
@Test
public void testReadObject() {
    MemoryAccessProvider memory = getConstantReflection().getMemoryAccessProvider();
    JavaConstant base = getSnippetReflection().forObject("");
    Stamp stamp = StampFactory.forKind(JavaKind.Object);
    assertTrue(stamp.readConstant(memory, base, 128) == null);
}
Also used : MemoryAccessProvider(jdk.vm.ci.meta.MemoryAccessProvider) Stamp(org.graalvm.compiler.core.common.type.Stamp) JavaConstant(jdk.vm.ci.meta.JavaConstant) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with MemoryAccessProvider

use of jdk.vm.ci.meta.MemoryAccessProvider in project graal by oracle.

the class StampMemoryAccessTest method testReadPrimitive.

@Ignore("not all JVMCI versions are safe yet")
@Test
public void testReadPrimitive() {
    MemoryAccessProvider memory = getConstantReflection().getMemoryAccessProvider();
    JavaConstant base = getSnippetReflection().forObject("");
    Stamp stamp = StampFactory.forKind(JavaKind.Long);
    assertTrue(stamp.readConstant(memory, base, 128) == null);
}
Also used : MemoryAccessProvider(jdk.vm.ci.meta.MemoryAccessProvider) Stamp(org.graalvm.compiler.core.common.type.Stamp) JavaConstant(jdk.vm.ci.meta.JavaConstant) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with MemoryAccessProvider

use of jdk.vm.ci.meta.MemoryAccessProvider in project graal by oracle.

the class HotSpotResolvedObjectTypeTest method testKlassLayoutHelper.

@Test
public void testKlassLayoutHelper() {
    Constant klass = HotSpotResolvedObjectType.fromObjectClass(this.getClass()).klass();
    MemoryAccessProvider memoryAccess = getProviders().getConstantReflection().getMemoryAccessProvider();
    GraalHotSpotVMConfig config = runtime().getVMConfig();
    Constant c = StampFactory.forKind(JavaKind.Int).readConstant(memoryAccess, klass, config.klassLayoutHelperOffset);
    assertTrue(c.toString(), c.getClass() == PrimitiveConstant.class);
    PrimitiveConstant pc = (PrimitiveConstant) c;
    assertTrue(pc.toString(), pc.getJavaKind() == JavaKind.Int);
}
Also used : MemoryAccessProvider(jdk.vm.ci.meta.MemoryAccessProvider) Constant(jdk.vm.ci.meta.Constant) PrimitiveConstant(jdk.vm.ci.meta.PrimitiveConstant) PrimitiveConstant(jdk.vm.ci.meta.PrimitiveConstant) GraalHotSpotVMConfig(org.graalvm.compiler.hotspot.GraalHotSpotVMConfig) Test(org.junit.Test)

Example 4 with MemoryAccessProvider

use of jdk.vm.ci.meta.MemoryAccessProvider in project graal by oracle.

the class HotSpotStampMemoryAccessTest method testReadNarrowObject.

@Ignore("not all versions are safe yet")
@Test
public void testReadNarrowObject() {
    CompressEncoding oopEncoding = runtime().getVMConfig().getOopEncoding();
    Assume.assumeTrue("Compressed oops must be enabled", runtime().getVMConfig().useCompressedOops);
    MemoryAccessProvider memory = getConstantReflection().getMemoryAccessProvider();
    JavaConstant base = getSnippetReflection().forObject("");
    ObjectStamp stamp = (ObjectStamp) StampFactory.forKind(JavaKind.Object);
    Stamp narrowStamp = HotSpotNarrowOopStamp.compressed(stamp, oopEncoding);
    assertTrue(narrowStamp.readConstant(memory, base, 128) == null);
}
Also used : MemoryAccessProvider(jdk.vm.ci.meta.MemoryAccessProvider) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) ObjectStamp(org.graalvm.compiler.core.common.type.ObjectStamp) HotSpotNarrowOopStamp(org.graalvm.compiler.hotspot.nodes.type.HotSpotNarrowOopStamp) Stamp(org.graalvm.compiler.core.common.type.Stamp) CompressEncoding(org.graalvm.compiler.core.common.CompressEncoding) JavaConstant(jdk.vm.ci.meta.JavaConstant) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

MemoryAccessProvider (jdk.vm.ci.meta.MemoryAccessProvider)4 Test (org.junit.Test)4 JavaConstant (jdk.vm.ci.meta.JavaConstant)3 Stamp (org.graalvm.compiler.core.common.type.Stamp)3 Ignore (org.junit.Ignore)3 Constant (jdk.vm.ci.meta.Constant)1 PrimitiveConstant (jdk.vm.ci.meta.PrimitiveConstant)1 CompressEncoding (org.graalvm.compiler.core.common.CompressEncoding)1 ObjectStamp (org.graalvm.compiler.core.common.type.ObjectStamp)1 GraalHotSpotVMConfig (org.graalvm.compiler.hotspot.GraalHotSpotVMConfig)1 HotSpotNarrowOopStamp (org.graalvm.compiler.hotspot.nodes.type.HotSpotNarrowOopStamp)1