本文整理汇总了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));
}
}
}
示例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());
}
}
示例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);
}
}
示例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());
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}