Search in sources :

Example 6 with DynamicObject

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

the class ObjectTypeSuperclassTest method testInstanceOf.

@Test
public void testInstanceOf() {
    final DynamicObject object = LAYOUT.createObjectTypeSuperclassTest(14);
    Assert.assertTrue(object.getShape().getObjectType() instanceof ObjectTypeSuperclass);
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 7 with DynamicObject

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

the class SemiFinalPropertiesTest method testSet.

@Test
public void testSet() {
    final DynamicObject object = LAYOUT.createSemiFinalPropertiesTest(14);
    Assert.assertEquals(14, LAYOUT.getValue(object));
    LAYOUT.setValueUnsafe(object, 22);
    Assert.assertEquals(22, LAYOUT.getValue(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 8 with DynamicObject

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

the class SemiFinalPropertiesTest method testGetDefault.

@Test
public void testGetDefault() {
    final DynamicObject object = LAYOUT.createSemiFinalPropertiesTest(14);
    Assert.assertEquals(14, LAYOUT.getValue(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 9 with DynamicObject

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

the class SemiFinalPropertiesTest method testCreate.

@Test
public void testCreate() {
    final DynamicObject object = LAYOUT.createSemiFinalPropertiesTest(14);
    Assert.assertNotNull(object);
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 10 with DynamicObject

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

the class ShapePropertiesTest method testObjectSetter.

@Test
public void testObjectSetter() {
    final DynamicObjectFactory factory = LAYOUT.createShapePropertiesTestShape(14);
    final DynamicObject object = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object));
    LAYOUT.setShapeProperty(object, 44);
    Assert.assertEquals(44, LAYOUT.getShapeProperty(object));
    final DynamicObject newObject = LAYOUT.createShapePropertiesTest(factory, 22);
    Assert.assertEquals(14, LAYOUT.getShapeProperty(newObject));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) 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