Search in sources :

Example 26 with DynamicObject

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

the class BasicTest method testSetGet.

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

Example 27 with DynamicObject

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

the class BuildArgumentsTest method testCreate.

@Test
public void testCreate() {
    final DynamicObjectFactory factory = LAYOUT.createPrepareArgumentsShape(14);
    final DynamicObject object = factory.newInstance(LAYOUT.build(1, 2));
    Assert.assertEquals(14, LAYOUT.getShapeProperty(object));
    Assert.assertEquals(1, LAYOUT.getA(object));
    Assert.assertEquals(2, LAYOUT.getB(object));
}
Also used : DynamicObjectFactory(com.oracle.truffle.api.object.DynamicObjectFactory) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 28 with DynamicObject

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

the class GuardsTest method testGuardDynamicObjectPositive.

@Test
public void testGuardDynamicObjectPositive() {
    final DynamicObject object = LAYOUT.createGuardsTest();
    Assert.assertTrue(LAYOUT.isGuardsTest(object));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 29 with DynamicObject

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

the class GuardsTest method testGuardObjectTypeNegative.

@Test
public void testGuardObjectTypeNegative() {
    final DynamicObject object = NEGATIVE_LAYOUT.createGuardsTestNegative();
    Assert.assertFalse(LAYOUT.isGuardsTest(object.getShape().getObjectType()));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 30 with DynamicObject

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

the class GuardsTest method testGuardDynamicObjectNegative.

@Test
public void testGuardDynamicObjectNegative() {
    final DynamicObject object = NEGATIVE_LAYOUT.createGuardsTestNegative();
    Assert.assertFalse(LAYOUT.isGuardsTest(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