Search in sources :

Example 31 with Constant

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);
}
Also used : Constant(jdk.vm.ci.meta.Constant) PrimitiveConstant(jdk.vm.ci.meta.PrimitiveConstant) PrimitiveConstant(jdk.vm.ci.meta.PrimitiveConstant)

Aggregations

Constant (jdk.vm.ci.meta.Constant)31 JavaConstant (jdk.vm.ci.meta.JavaConstant)15 PrimitiveConstant (jdk.vm.ci.meta.PrimitiveConstant)11 ValueNode (org.graalvm.compiler.nodes.ValueNode)9 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)6 IntegerStamp (org.graalvm.compiler.core.common.type.IntegerStamp)5 Stamp (org.graalvm.compiler.core.common.type.Stamp)5 ArrayList (java.util.ArrayList)4 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)4 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)3 LIRValueUtil.asJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant)3 LIRValueUtil.isJavaConstant (org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant)3 RegisterValue (jdk.vm.ci.code.RegisterValue)2 HotSpotCompressedNullConstant (jdk.vm.ci.hotspot.HotSpotCompressedNullConstant)2 HotSpotObjectConstant (jdk.vm.ci.hotspot.HotSpotObjectConstant)2 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)2 SerializableConstant (jdk.vm.ci.meta.SerializableConstant)2 VMConstant (jdk.vm.ci.meta.VMConstant)2 Value (jdk.vm.ci.meta.Value)2 OperandSize (org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize)2