use of org.graalvm.compiler.nodes.java.MethodCallTargetNode in project graal by oracle.
the class VerifyDebugUsage method verify.
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
metaAccess = context.getMetaAccess();
ResolvedJavaType debugType = metaAccess.lookupJavaType(DebugContext.class);
ResolvedJavaType nodeType = metaAccess.lookupJavaType(Node.class);
ResolvedJavaType stringType = metaAccess.lookupJavaType(String.class);
ResolvedJavaType graalErrorType = metaAccess.lookupJavaType(GraalError.class);
for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
ResolvedJavaMethod callee = t.targetMethod();
String calleeName = callee.getName();
if (callee.getDeclaringClass().equals(debugType)) {
boolean isDump = calleeName.equals("dump");
if (calleeName.equals("log") || calleeName.equals("logAndIndent") || calleeName.equals("verify") || isDump) {
verifyParameters(t, graph, t.arguments(), stringType, isDump ? 2 : 1);
}
}
if (callee.getDeclaringClass().isAssignableFrom(nodeType)) {
if (calleeName.equals("assertTrue") || calleeName.equals("assertFalse")) {
verifyParameters(t, graph, t.arguments(), stringType, 1);
}
}
if (callee.getDeclaringClass().isAssignableFrom(graalErrorType) && !graph.method().getDeclaringClass().isAssignableFrom(graalErrorType)) {
if (calleeName.equals("guarantee")) {
verifyParameters(t, graph, t.arguments(), stringType, 0);
}
if (calleeName.equals("<init>") && callee.getSignature().getParameterCount(false) == 2) {
verifyParameters(t, graph, t.arguments(), stringType, 1);
}
}
}
return true;
}
Aggregations