use of jdk.vm.ci.meta.Constant in project graal by oracle.
the class VerifyDebugUsage method verifyDumpLevelParameter.
/**
* The {@code level} arg for the {@code Debug.dump(...)} methods must be a reference to one of
* the {@code Debug.*_LEVEL} constants.
*/
protected Integer verifyDumpLevelParameter(StructuredGraph callerGraph, MethodCallTargetNode debugCallTarget, ResolvedJavaMethod verifiedCallee, ValueNode arg) throws org.graalvm.compiler.phases.VerifyPhase.VerificationError {
// The 'level' arg for the Debug.dump(...) methods must be a reference to one of
// the Debug.*_LEVEL constants.
Constant c = arg.asConstant();
if (c != null) {
Integer dumpLevel = ((PrimitiveConstant) c).asInt();
if (!DebugLevels.contains(dumpLevel)) {
StackTraceElement e = callerGraph.method().asStackTraceElement(debugCallTarget.invoke().bci());
throw new VerificationError("In %s: parameter 0 of call to %s does not match a Debug.*_LEVEL constant: %s.%n", e, verifiedCallee.format("%H.%n(%p)"), dumpLevel);
}
return dumpLevel;
}
StackTraceElement e = callerGraph.method().asStackTraceElement(debugCallTarget.invoke().bci());
throw new VerificationError("In %s: parameter 0 of call to %s must be a constant, not %s.%n", e, verifiedCallee.format("%H.%n(%p)"), arg);
}
Aggregations