Search in sources :

Example 86 with DynamicObject

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

the class GuardsTest method testGuardObjectTypePositive.

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

Example 87 with DynamicObject

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

the class IdentifierTest method testSet.

@Test
public void testSet() {
    final DynamicObject object = LAYOUT.createIdentifierTest(1, 2);
    Assert.assertEquals(1, object.get(IdentifierTestLayout.A_IDENTIFIER));
    object.set(IdentifierTestLayout.A_IDENTIFIER, 11);
    Assert.assertEquals(11, object.get(IdentifierTestLayout.A_IDENTIFIER));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 88 with DynamicObject

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

the class ImplicitCastTest method testCantAssignIntToLong.

@Test(expected = IncompatibleLocationException.class)
public void testCantAssignIntToLong() throws IncompatibleLocationException, FinalLocationException {
    final DynamicObject object = NO_CAST_LAYOUT.createNoCast(14, 14.2);
    object.getShape().getProperty(NoCastLayout.LONG_VALUE_IDENTIFIER).set(object, 14, object.getShape());
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 89 with DynamicObject

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

the class InheritanceTest method testTopGuardsOnMiddle.

@Test
public void testTopGuardsOnMiddle() {
    final DynamicObject object = MIDDLE_LAYOUT.createMiddle(14, "foo");
    Assert.assertFalse(TOP_LAYOUT.isTop(object));
    Assert.assertFalse(TOP_LAYOUT.isTop((Object) object));
    Assert.assertFalse(TOP_LAYOUT.isTop(object.getShape().getObjectType()));
    Assert.assertFalse(TOP_LAYOUT.isTop(object));
    Assert.assertFalse(TOP_LAYOUT.isTop((Object) object));
    Assert.assertFalse(TOP_LAYOUT.isTop(object.getShape().getObjectType()));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) DynamicObject(com.oracle.truffle.api.object.DynamicObject) Test(org.junit.Test)

Example 90 with DynamicObject

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

the class InheritanceTest method testBaseGuardsOnBase.

@Test
public void testBaseGuardsOnBase() {
    final DynamicObject object = BASE_LAYOUT.createBase(14);
    Assert.assertTrue(BASE_LAYOUT.isBase(object));
    Assert.assertTrue(BASE_LAYOUT.isBase((Object) object));
    Assert.assertTrue(BASE_LAYOUT.isBase(object.getShape().getObjectType()));
    Assert.assertTrue(BASE_LAYOUT.isBase(object));
    Assert.assertTrue(BASE_LAYOUT.isBase((Object) object));
    Assert.assertTrue(BASE_LAYOUT.isBase(object.getShape().getObjectType()));
}
Also used : DynamicObject(com.oracle.truffle.api.object.DynamicObject) 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