java basic data type,Java BasicType.T_ARRAY属性代码示例

private ValueImpl getSlotValue(StackValueCollection values,

BasicType variableType, int ss) {

ValueImpl valueImpl = null;

OopHandle handle = null;

ObjectHeap heap = vm.saObjectHeap();

if (values.get(ss).getType() == BasicType.getTConflict()) {

// Dead locals, so just represent them as a zero of the appropriate type

if (variableType == BasicType.T_BOOLEAN) {

valueImpl = (BooleanValueImpl) vm.mirrorOf(false);

} else if (variableType == BasicType.T_CHAR) {

valueImpl = (CharValueImpl) vm.mirrorOf((char)0);

} else if (variableType == BasicType.T_FLOAT) {

valueImpl = (FloatValueImpl) vm.mirrorOf((float)0);

} else if (variableType == BasicType.T_DOUBLE) {

valueImpl = (DoubleValueImpl) vm.mirrorOf((double)0);

} else if (variableType == BasicType.T_BYTE) {

valueImpl = (ByteValueImpl) vm.mirrorOf((byte)0);

} else if (variableType == BasicType.T_SHORT) {

valueImpl = (ShortValueImpl) vm.mirrorOf((short)0);

} else if (variableType == BasicType.T_INT) {

valueImpl = (IntegerValueImpl) vm.mirrorOf((int)0);

} else if (variableType == BasicType.T_LONG) {

valueImpl = (LongValueImpl) vm.mirrorOf((long)0);

} else if (variableType == BasicType.T_OBJECT) {

// we may have an [Ljava/lang/Object; - i.e., Object[] with the

// elements themselves may be arrays because every array is an Object.

handle = null;

valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));

} else if (variableType == BasicType.T_ARRAY) {

handle = null;

valueImpl = vm.arrayMirror((Array)heap.newOop(handle));

} else if (variableType == BasicType.T_VOID) {

valueImpl = new VoidValueImpl(vm);

} else {

throw new RuntimeException("Should not read here");

}

} else {

if (variableType == BasicType.T_BOOLEAN) {

valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss));

} else if (variableType == BasicType.T_CHAR) {

valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss));

} else if (variableType == BasicType.T_FLOAT) {

valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss));

} else if (variableType == BasicType.T_DOUBLE) {

valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss));

} else if (variableType == BasicType.T_BYTE) {

valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss));

} else if (variableType == BasicType.T_SHORT) {

valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss));

} else if (variableType == BasicType.T_INT) {

valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss));

} else if (variableType == BasicType.T_LONG) {

valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss));

} else if (variableType == BasicType.T_OBJECT) {

// we may have an [Ljava/lang/Object; - i.e., Object[] with the

// elements themselves may be arrays because every array is an Object.

handle = values.oopHandleAt(ss);

valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle));

} else if (variableType == BasicType.T_ARRAY) {

handle = values.oopHandleAt(ss);

valueImpl = vm.arrayMirror((Array)heap.newOop(handle));

} else if (variableType == BasicType.T_VOID) {

valueImpl = new VoidValueImpl(vm);

} else {

throw new RuntimeException("Should not read here");

}

}

return valueImpl;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值