当前位置: 首页>>代码示例>>Java>>正文


Java JavaConstant.asInt方法代码示例

本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.asInt方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.asInt方法的具体用法?Java JavaConstant.asInt怎么用?Java JavaConstant.asInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.vm.ci.meta.JavaConstant的用法示例。


在下文中一共展示了JavaConstant.asInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: genIntegerSwitch

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
protected void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors) {
    if (value.isConstant()) {
        JavaConstant constant = (JavaConstant) value.asConstant();
        int constantValue = constant.asInt();
        for (int i = 0; i < keys.length; ++i) {
            if (keys[i] == constantValue) {
                appendGoto(actualSuccessors.get(keySuccessors[i]));
                return;
            }
        }
        appendGoto(actualSuccessors.get(keySuccessors[keys.length]));
    } else {
        this.controlFlowSplit = true;
        double[] successorProbabilities = successorProbabilites(actualSuccessors.size(), keySuccessors, keyProbabilities);
        IntegerSwitchNode switchNode = append(new IntegerSwitchNode(value, actualSuccessors.size(), keys, keyProbabilities, keySuccessors));
        for (int i = 0; i < actualSuccessors.size(); i++) {
            switchNode.setBlockSuccessor(i, createBlockTarget(successorProbabilities[i], actualSuccessors.get(i), frameState));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:BytecodeParser.java

示例2: isBoxCached

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
/**
 * Check if the constant is a boxed value that is guaranteed to be cached by the platform.
 * Otherwise the generated code might be the only reference to the boxed value and since object
 * references from nmethods are weak this can cause GC problems.
 *
 * @param source
 * @return true if the box is cached
 */
private static boolean isBoxCached(JavaConstant source) {
    switch (source.getJavaKind()) {
        case Boolean:
            return true;
        case Char:
            return source.asInt() <= 127;
        case Byte:
        case Short:
        case Int:
            return source.asInt() >= -128 && source.asInt() <= 127;
        case Long:
            return source.asLong() >= -128 && source.asLong() <= 127;
        case Float:
        case Double:
            return false;
        default:
            throw new IllegalArgumentException("unexpected kind " + source.getJavaKind());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:HotSpotConstantReflectionProvider.java

示例3: asLong

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
private static long asLong(JavaConstant value) {
    JavaKind kind = value.getJavaKind();
    switch (kind) {
        case Byte:
        case Short:
        case Char:
        case Int:
            return value.asInt();
        case Long:
            return value.asLong();
        default:
            throw new IllegalArgumentException("not an integer kind: " + kind);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:HotSpotCounterOp.java

示例4: const2reg

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
private static void const2reg(CompilationResultBuilder crb, AArch64MacroAssembler masm, Value result, JavaConstant input) {
    Register dst = asRegister(result);
    switch (input.getJavaKind().getStackKind()) {
        case Int:
            final int value = input.asInt();
            int maskedValue;
            switch (input.getJavaKind()) {
                case Boolean:
                case Byte:
                    maskedValue = value & 0xFF;
                    break;
                case Char:
                case Short:
                    maskedValue = value & 0xFFFF;
                    break;
                case Int:
                    maskedValue = value;
                    break;
                default:
                    throw GraalError.shouldNotReachHere();
            }
            masm.mov(dst, maskedValue);
            break;
        case Long:
            masm.mov(dst, input.asLong());
            break;
        case Float:
            if (AArch64MacroAssembler.isFloatImmediate(input.asFloat())) {
                masm.fmov(32, dst, input.asFloat());
            } else {
                masm.fldr(32, dst, (AArch64Address) crb.asFloatConstRef(input));
            }
            break;
        case Double:
            if (AArch64MacroAssembler.isDoubleImmediate(input.asDouble())) {
                masm.fmov(64, dst, input.asDouble());
            } else {
                masm.fldr(64, dst, (AArch64Address) crb.asDoubleConstRef(input));
            }
            break;
        case Object:
            if (input.isNull()) {
                masm.mov(dst, 0);
            } else if (crb.target.inlineObjects) {
                crb.recordInlineDataInCode(input);
                masm.movNativeAddress(dst, 0xDEADDEADDEADDEADL);
            } else {
                masm.ldr(64, dst, (AArch64Address) crb.recordDataReferenceInCode(input, 8));
            }
            break;
        default:
            throw GraalError.shouldNotReachHere("kind=" + input.getJavaKind().getStackKind());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:55,代码来源:AArch64Move.java

示例5: isHeapWordAligned

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
boolean isHeapWordAligned(JavaConstant value, JavaKind kind) {
    return (getArrayBaseOffset(kind) + (long) value.asInt() * getArrayIndexScale(kind)) % runtime.getVMConfig().heapWordSize == 0;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ArrayCopyCallNode.java

示例6: decodeDeoptReason

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public DeoptimizationReason decodeDeoptReason(JavaConstant constant) {
    HotSpotVMConfig config = runtime.getConfig();
    int reasonValue = ((~constant.asInt()) >> config.deoptimizationReasonShift) & intMaskRight(config.deoptimizationReasonBits);
    DeoptimizationReason reason = convertDeoptReason(reasonValue);
    return reason;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:HotSpotMetaAccessProvider.java

示例7: decodeDeoptAction

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public DeoptimizationAction decodeDeoptAction(JavaConstant constant) {
    HotSpotVMConfig config = runtime.getConfig();
    int actionValue = ((~constant.asInt()) >> config.deoptimizationActionShift) & intMaskRight(config.deoptimizationActionBits);
    DeoptimizationAction action = convertDeoptAction(actionValue);
    return action;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:HotSpotMetaAccessProvider.java

示例8: decodeDebugId

import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public int decodeDebugId(JavaConstant constant) {
    HotSpotVMConfig config = runtime.getConfig();
    return ((~constant.asInt()) >> config.deoptimizationDebugIdShift) & intMaskRight(config.deoptimizationDebugIdBits);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:HotSpotMetaAccessProvider.java


注:本文中的jdk.vm.ci.meta.JavaConstant.asInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。