本文整理汇总了Java中jdk.vm.ci.meta.JavaValue类的典型用法代码示例。如果您正苦于以下问题:Java JavaValue类的具体用法?Java JavaValue怎么用?Java JavaValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaValue类属于jdk.vm.ci.meta包,在下文中一共展示了JavaValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitValues
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected void visitValues(LIRInstruction inst, JavaValue[] values, InstructionValueConsumer proc) {
for (int i = 0; i < values.length; i++) {
JavaValue value = values[i];
if (isIllegalJavaValue(value)) {
continue;
} else if (value instanceof AllocatableValue) {
proc.visitValue(inst, (AllocatableValue) value, OperandMode.ALIVE, STATE_FLAGS);
} else if (value instanceof StackLockValue) {
StackLockValue monitor = (StackLockValue) value;
JavaValue owner = monitor.getOwner();
if (owner instanceof AllocatableValue) {
proc.visitValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS);
}
Value slot = monitor.getSlot();
if (isVirtualStackSlot(slot)) {
proc.visitValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS);
}
} else {
assert unprocessed(value);
}
}
}
示例2: test
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected void test(DebugInfoCompiler compiler, Method method, int bci, JavaKind... slotKinds) {
ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(method);
int numLocals = resolvedMethod.getMaxLocals();
int numStack = slotKinds.length - numLocals;
JavaValue[] values = new JavaValue[slotKinds.length];
test(asm -> {
VirtualObject[] vobjs = compiler.compile(asm, values);
BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0);
DebugInfo info = new DebugInfo(frame, vobjs);
info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
asm.emitTrap(info);
}, method);
}
示例3: checkValues
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
private boolean checkValues(ResolvedJavaType type, JavaValue[] values, JavaKind[] slotKinds) {
assert (values == null) == (slotKinds == null);
if (values != null) {
assert values.length == slotKinds.length;
if (!type.isArray()) {
ResolvedJavaField[] fields = type.getInstanceFields(true);
int fieldIndex = 0;
for (int i = 0; i < values.length; i++) {
ResolvedJavaField field = fields[fieldIndex++];
JavaKind valKind = slotKinds[i].getStackKind();
JavaKind fieldKind = storageKind(field.getType());
if (fieldKind == JavaKind.Object) {
assert valKind.isObject() : field + ": " + valKind + " != " + fieldKind;
} else {
if ((valKind == JavaKind.Double || valKind == JavaKind.Long) && fieldKind == JavaKind.Int) {
assert storageKind(fields[fieldIndex].getType()) == JavaKind.Int;
fieldIndex++;
} else {
assert valKind == fieldKind.getStackKind() : field + ": " + valKind + " != " + fieldKind;
}
}
}
assert fields.length == fieldIndex : type + ": fields=" + Arrays.toString(fields) + ", field values=" + Arrays.toString(values);
} else {
JavaKind componentKind = storageKind(type.getComponentType()).getStackKind();
if (componentKind == JavaKind.Object) {
for (int i = 0; i < values.length; i++) {
assert slotKinds[i].isObject() : slotKinds[i] + " != " + componentKind;
}
} else {
for (int i = 0; i < values.length; i++) {
assert slotKinds[i] == componentKind || componentKind.getBitCount() >= slotKinds[i].getBitCount() ||
(componentKind == JavaKind.Int && slotKinds[i].getBitCount() >= JavaKind.Int.getBitCount()) : slotKinds[i] + " != " + componentKind;
}
}
}
}
return true;
}
示例4: computeLocals
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected void computeLocals(FrameState state, int numLocals, JavaValue[] values, JavaKind[] slotKinds) {
for (int i = 0; i < numLocals; i++) {
ValueNode local = state.localAt(i);
values[i] = toJavaValue(local);
slotKinds[i] = toSlotKind(local);
}
}
示例5: computeStack
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected void computeStack(FrameState state, int numLocals, int numStack, JavaValue[] values, JavaKind[] slotKinds) {
for (int i = 0; i < numStack; i++) {
ValueNode stack = state.stackAt(i);
values[numLocals + i] = toJavaValue(stack);
slotKinds[numLocals + i] = toSlotKind(stack);
}
}
示例6: valueToString
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected String valueToString(JavaValue value, List<VirtualObject> virtualObjects) {
if (value == null) {
return "-";
}
if (value instanceof VirtualObject && !virtualObjects.contains(value)) {
virtualObjects.add((VirtualObject) value);
}
return value.toString();
}
示例7: processValues
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
protected void processValues(LIRInstruction inst, JavaValue[] values, InstructionValueProcedure proc) {
for (int i = 0; i < values.length; i++) {
JavaValue value = values[i];
if (isIllegalJavaValue(value)) {
continue;
}
if (value instanceof AllocatableValue) {
AllocatableValue allocatable = (AllocatableValue) value;
Value result = proc.doValue(inst, allocatable, OperandMode.ALIVE, STATE_FLAGS);
if (!allocatable.identityEquals(result)) {
values[i] = (JavaValue) result;
}
} else if (value instanceof StackLockValue) {
StackLockValue monitor = (StackLockValue) value;
JavaValue owner = monitor.getOwner();
if (owner instanceof AllocatableValue) {
monitor.setOwner((JavaValue) proc.doValue(inst, (AllocatableValue) owner, OperandMode.ALIVE, STATE_FLAGS));
}
Value slot = monitor.getSlot();
if (isVirtualStackSlot(slot)) {
monitor.setSlot(asAllocatableValue(proc.doValue(inst, slot, OperandMode.ALIVE, STATE_FLAGS)));
}
} else {
assert unprocessed(value);
}
}
}
示例8: unprocessed
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
private boolean unprocessed(JavaValue value) {
if (isIllegalJavaValue(value)) {
// Ignore dead local variables.
return true;
} else if (isConstantJavaValue(value)) {
// Ignore constants, the register allocator does not need to see them.
return true;
} else if (isVirtualObject(value)) {
assert Arrays.asList(virtualObjects).contains(value);
return true;
} else {
return false;
}
}
示例9: testUnexpectedScopeValuesLength
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testUnexpectedScopeValuesLength() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{JavaConstant.FALSE}, new JavaKind[0], 0, 0, 0);
safepoint.accept(newState);
});
}
示例10: testUnexpectedScopeSlotKindsLength
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testUnexpectedScopeSlotKindsLength() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[0], new JavaKind[]{JavaKind.Boolean}, 0, 0, 0);
safepoint.accept(newState);
});
}
示例11: testWrongMonitorType
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testWrongMonitorType() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{JavaConstant.INT_0}, new JavaKind[]{}, 0, 0, 1);
safepoint.accept(newState);
});
}
示例12: testUnexpectedIllegalValue
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testUnexpectedIllegalValue() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{Value.ILLEGAL}, new JavaKind[]{JavaKind.Int}, 1, 0, 0);
safepoint.accept(newState);
});
}
示例13: testUnexpectedTypeInRegister
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testUnexpectedTypeInRegister() {
test((tool, state, safepoint) -> {
Variable var = tool.newVariable(LIRKind.fromJavaKind(tool.target().arch, JavaKind.Int));
tool.append(new ValueDef(var));
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{var}, new JavaKind[]{JavaKind.Illegal}, 1, 0, 0);
safepoint.accept(newState);
});
}
示例14: testWrongConstantType
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testWrongConstantType() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{JavaConstant.INT_0}, new JavaKind[]{JavaKind.Object}, 1, 0, 0);
safepoint.accept(newState);
});
}
示例15: testUnsupportedConstantType
import jdk.vm.ci.meta.JavaValue; //导入依赖的package包/类
@Test(expected = JVMCIError.class)
public void testUnsupportedConstantType() {
test((tool, state, safepoint) -> {
LIRFrameState newState = modifyTopFrame(state, new JavaValue[]{JavaConstant.forShort((short) 0)}, new JavaKind[]{JavaKind.Short}, 1, 0, 0);
safepoint.accept(newState);
});
}