Search in sources :

Example 96 with DynamicObject

use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.

the class ObjectTypePublicTest method testIsPublic.

@Test
public void testIsPublic() {
    final DynamicObject instance = LAYOUT.createObjectTypePublicTest(14);
    assertTrue(ObjectTypePublicTestLayoutImpl.ObjectTypePublicTestType.class.isAssignableFrom(instance.getShape().getObjectType().getClass()));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 97 with DynamicObject

use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.

the class ShapePropertiesTest method testObjectGetter.

@Test
public void testObjectGetter() {
    final DynamicObjectFactory factory = LAYOUT.createShapePropertiesTestShape(14);
    final DynamicObject object = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 98 with DynamicObject

use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.

the class TypesTest method testIntArrayArray.

@Test
public void testIntArrayArray() {
    final DynamicObject object = create();
    Assert.assertArrayEquals(new int[][] { { 1 }, { 2 } }, LAYOUT.getIaa(object));
    LAYOUT.setIaa(object, new int[][] { { 11 }, { 22 } });
    Assert.assertArrayEquals(new int[][] { { 11 }, { 22 } }, LAYOUT.getIaa(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 99 with DynamicObject

use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.

the class TypesTest method testBigInteger.

@Test
public void testBigInteger() {
    final DynamicObject object = create();
    Assert.assertEquals(BigInteger.TEN, LAYOUT.getBi(object));
    LAYOUT.setBi(object, BigInteger.ONE);
    Assert.assertEquals(BigInteger.ONE, LAYOUT.getBi(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 100 with DynamicObject

use of com.oracle.truffle.api.object.DynamicObject in project graal by oracle.

the class VolatileTest method testSetVolatile.

@Test
public void testSetVolatile() {
    final DynamicObject object = LAYOUT.createVolatileTest(14, null);
    Assert.assertEquals(14, LAYOUT.getVolatileInt(object));
    LAYOUT.setVolatileInt(object, 22);
    Assert.assertEquals(22, LAYOUT.getVolatileInt(object));
    Assert.assertNull(LAYOUT.getVolatileThread(object));
    LAYOUT.setVolatileThread(object, Thread.currentThread());
    Assert.assertEquals(Thread.currentThread(), LAYOUT.getVolatileThread(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Aggregations

DynamicObject (com.oracle.truffle.api.object.DynamicObject)100 Test (org.junit.Test)91 Location (com.oracle.truffle.api.object.Location)17 Shape (com.oracle.truffle.api.object.Shape)16 DynamicObjectFactory (com.oracle.truffle.api.object.DynamicObjectFactory)8 ObjectLocation (com.oracle.truffle.api.object.ObjectLocation)7 Property (com.oracle.truffle.api.object.Property)7 ObjectType (com.oracle.truffle.api.object.ObjectType)6 IncompatibleLocationException (com.oracle.truffle.api.object.IncompatibleLocationException)4 Layout (com.oracle.truffle.api.object.Layout)4 FinalLocationException (com.oracle.truffle.api.object.FinalLocationException)2 PropertyBuilder (com.oracle.truffle.object.dsl.processor.model.PropertyBuilder)2 VariableElement (javax.lang.model.element.VariableElement)2 LocationFactory (com.oracle.truffle.api.object.LocationFactory)1 ShapeImpl (com.oracle.truffle.object.ShapeImpl)1 DefaultLayoutFactory (com.oracle.truffle.object.basic.DefaultLayoutFactory)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 IdentityHashMap (java.util.IdentityHashMap)1