Search in sources :

Example 1 with Id

use of org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id in project graal by oracle.

the class TruffleFromLibGraalEntryPoints method checkHotSpotCalls.

/*----------------------*/
/**
 * Checks that all {@link TruffleFromLibGraal}s are implemented and that their signatures match
 * the {@linkplain Id#getSignature() ID signatures}.
 */
private static boolean checkHotSpotCalls() {
    Set<Id> unimplemented = EnumSet.allOf(Id.class);
    for (Method method : TruffleFromLibGraalEntryPoints.class.getDeclaredMethods()) {
        if (Modifier.isStatic(method.getModifiers())) {
            TruffleFromLibGraal a = method.getAnnotation(TruffleFromLibGraal.class);
            if (a != null) {
                Id id = a.value();
                unimplemented.remove(id);
                check(id, id.getMethodName().equals(method.getName()), "Expected name \"%s\", got \"%s\"", id.getMethodName(), method.getName());
                check(id, id.getReturnType().equals(method.getReturnType()), "Expected return type %s, got %s", id.getReturnType().getName(), method.getReturnType().getName());
                checkParameters(id, method.getParameterTypes());
            }
        }
    }
    check(null, unimplemented.isEmpty(), "Missing implementations:%n%s", unimplemented.stream().map(TruffleFromLibGraalEntryPoints::missingImpl).sorted().collect(joining(lineSeparator())));
    return true;
}
Also used : TruffleFromLibGraal(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal) Id(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id) GetNodeId(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.GetNodeId) Method(java.lang.reflect.Method) IsSpecializationMethod(org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.IsSpecializationMethod) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

Method (java.lang.reflect.Method)1 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)1 TruffleFromLibGraal (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal)1 Id (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id)1 GetNodeId (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.GetNodeId)1 IsSpecializationMethod (org.graalvm.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id.IsSpecializationMethod)1