229 private ValueImpl getSlotValue(StackValueCollection values, |
234 private ValueImpl getSlotValue(StackValueCollection values, |
230 BasicType variableType, int ss) { |
235 BasicType variableType, int ss) { |
231 ValueImpl valueImpl = null; |
236 ValueImpl valueImpl = null; |
232 OopHandle handle = null; |
237 OopHandle handle = null; |
233 ObjectHeap heap = vm.saObjectHeap(); |
238 ObjectHeap heap = vm.saObjectHeap(); |
234 if (variableType == BasicType.T_BOOLEAN) { |
239 if (values.get(ss).getType() == BasicType.getTConflict()) { |
|
240 // Dead locals, so just represent them as a zero of the appropriate type |
|
241 if (variableType == BasicType.T_BOOLEAN) { |
|
242 valueImpl = (BooleanValueImpl) vm.mirrorOf(false); |
|
243 } else if (variableType == BasicType.T_CHAR) { |
|
244 valueImpl = (CharValueImpl) vm.mirrorOf((char)0); |
|
245 } else if (variableType == BasicType.T_FLOAT) { |
|
246 valueImpl = (FloatValueImpl) vm.mirrorOf((float)0); |
|
247 } else if (variableType == BasicType.T_DOUBLE) { |
|
248 valueImpl = (DoubleValueImpl) vm.mirrorOf((double)0); |
|
249 } else if (variableType == BasicType.T_BYTE) { |
|
250 valueImpl = (ByteValueImpl) vm.mirrorOf((byte)0); |
|
251 } else if (variableType == BasicType.T_SHORT) { |
|
252 valueImpl = (ShortValueImpl) vm.mirrorOf((short)0); |
|
253 } else if (variableType == BasicType.T_INT) { |
|
254 valueImpl = (IntegerValueImpl) vm.mirrorOf((int)0); |
|
255 } else if (variableType == BasicType.T_LONG) { |
|
256 valueImpl = (LongValueImpl) vm.mirrorOf((long)0); |
|
257 } else if (variableType == BasicType.T_OBJECT) { |
|
258 // we may have an [Ljava/lang/Object; - i.e., Object[] with the |
|
259 // elements themselves may be arrays because every array is an Object. |
|
260 handle = null; |
|
261 valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle)); |
|
262 } else if (variableType == BasicType.T_ARRAY) { |
|
263 handle = null; |
|
264 valueImpl = vm.arrayMirror((Array)heap.newOop(handle)); |
|
265 } else if (variableType == BasicType.T_VOID) { |
|
266 valueImpl = new VoidValueImpl(vm); |
|
267 } else { |
|
268 throw new RuntimeException("Should not read here"); |
|
269 } |
|
270 } else { |
|
271 if (variableType == BasicType.T_BOOLEAN) { |
235 valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss)); |
272 valueImpl = (BooleanValueImpl) vm.mirrorOf(values.booleanAt(ss)); |
236 } else if (variableType == BasicType.T_CHAR) { |
273 } else if (variableType == BasicType.T_CHAR) { |
237 valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss)); |
274 valueImpl = (CharValueImpl) vm.mirrorOf(values.charAt(ss)); |
238 } else if (variableType == BasicType.T_FLOAT) { |
275 } else if (variableType == BasicType.T_FLOAT) { |
239 valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss)); |
276 valueImpl = (FloatValueImpl) vm.mirrorOf(values.floatAt(ss)); |
240 } else if (variableType == BasicType.T_DOUBLE) { |
277 } else if (variableType == BasicType.T_DOUBLE) { |
241 valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss)); |
278 valueImpl = (DoubleValueImpl) vm.mirrorOf(values.doubleAt(ss)); |
242 } else if (variableType == BasicType.T_BYTE) { |
279 } else if (variableType == BasicType.T_BYTE) { |
243 valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss)); |
280 valueImpl = (ByteValueImpl) vm.mirrorOf(values.byteAt(ss)); |
244 } else if (variableType == BasicType.T_SHORT) { |
281 } else if (variableType == BasicType.T_SHORT) { |
245 valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss)); |
282 valueImpl = (ShortValueImpl) vm.mirrorOf(values.shortAt(ss)); |
246 } else if (variableType == BasicType.T_INT) { |
283 } else if (variableType == BasicType.T_INT) { |
247 valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss)); |
284 valueImpl = (IntegerValueImpl) vm.mirrorOf(values.intAt(ss)); |
248 } else if (variableType == BasicType.T_LONG) { |
285 } else if (variableType == BasicType.T_LONG) { |
249 valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss)); |
286 valueImpl = (LongValueImpl) vm.mirrorOf(values.longAt(ss)); |
250 } else if (variableType == BasicType.T_OBJECT) { |
287 } else if (variableType == BasicType.T_OBJECT) { |
251 // we may have an [Ljava/lang/Object; - i.e., Object[] with the |
288 // we may have an [Ljava/lang/Object; - i.e., Object[] with the |
252 // elements themselves may be arrays because every array is an Object. |
289 // elements themselves may be arrays because every array is an Object. |
253 handle = values.oopHandleAt(ss); |
290 handle = values.oopHandleAt(ss); |
254 valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle)); |
291 valueImpl = (ObjectReferenceImpl) vm.objectMirror(heap.newOop(handle)); |
255 } else if (variableType == BasicType.T_ARRAY) { |
292 } else if (variableType == BasicType.T_ARRAY) { |
256 handle = values.oopHandleAt(ss); |
293 handle = values.oopHandleAt(ss); |
257 valueImpl = vm.arrayMirror((Array)heap.newOop(handle)); |
294 valueImpl = vm.arrayMirror((Array)heap.newOop(handle)); |
258 } else if (variableType == BasicType.T_VOID) { |
295 } else if (variableType == BasicType.T_VOID) { |
259 valueImpl = new VoidValueImpl(vm); |
296 valueImpl = new VoidValueImpl(vm); |
260 } else { |
297 } else { |
261 throw new RuntimeException("Should not read here"); |
298 throw new RuntimeException("Should not read here"); |
|
299 } |
262 } |
300 } |
263 |
301 |
264 return valueImpl; |
302 return valueImpl; |
265 } |
303 } |
266 |
304 |