use of com.oracle.truffle.api.CompilerDirectives.CompilationFinal in project graal by oracle.
the class GraalTruffleRuntime method getConstantFieldInfo.
@Override
public ConstantFieldInfo getConstantFieldInfo(ResolvedJavaField field) {
for (Annotation a : field.getAnnotations()) {
if (a.annotationType() == Child.class) {
return TruffleCompilerRuntime.ConstantFieldInfo.CHILD;
}
if (a.annotationType() == Children.class) {
return TruffleCompilerRuntime.ConstantFieldInfo.CHILDREN;
}
if (a.annotationType() == CompilationFinal.class) {
CompilationFinal cf = (CompilationFinal) a;
int dimensions = actualStableDimensions(field, cf.dimensions());
return TruffleCompilerRuntime.ConstantFieldInfo.forDimensions(dimensions);
}
}
return null;
}
use of com.oracle.truffle.api.CompilerDirectives.CompilationFinal in project graal by oracle.
the class AssumptionsTest method testAssumptionArraysAreCompilationFinalCached.
@Test
public void testAssumptionArraysAreCompilationFinalCached() throws NoSuchFieldException, SecurityException, IllegalArgumentException {
AssumptionArraysAreCompilationFinalCached node = TestHelper.createNode(AssumptionArraysAreCompilationFinalCachedFactory.getInstance(), false);
Field doCachedField = node.getClass().getDeclaredField("do1_cache");
doCachedField.setAccessible(true);
Field field = doCachedField.getType().getDeclaredField("assumption0_");
field.setAccessible(true);
assertEquals(Assumption[].class, field.getType());
CompilationFinal compilationFinal = field.getAnnotation(CompilationFinal.class);
assertEquals(1, compilationFinal.dimensions());
}
use of com.oracle.truffle.api.CompilerDirectives.CompilationFinal in project graal by oracle.
the class AssumptionsTest method testAssumptionArraysAreCompilationFinal.
@Test
public void testAssumptionArraysAreCompilationFinal() throws NoSuchFieldException, SecurityException {
AssumptionArraysAreCompilationFinal node = TestHelper.createNode(AssumptionArraysAreCompilationFinalFactory.getInstance(), false);
Field field = node.getClass().getDeclaredField("do1_assumption0_");
field.setAccessible(true);
assertEquals(Assumption[].class, field.getType());
CompilationFinal compilationFinal = field.getAnnotation(CompilationFinal.class);
assertEquals(1, compilationFinal.dimensions());
}
Aggregations