hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/StackFrameImpl.java
changeset 10517 f92c9ff3a15f
parent 5547 f4b087cbb361
equal deleted inserted replaced
10516:2797e487c09f 10517:f92c9ff3a15f
   121             StackValueCollection values = saFrame.getLocals();
   121             StackValueCollection values = saFrame.getLocals();
   122             if (Assert.ASSERTS_ENABLED) {
   122             if (Assert.ASSERTS_ENABLED) {
   123                 Assert.that(values.size() > 0, "this is missing");
   123                 Assert.that(values.size() > 0, "this is missing");
   124             }
   124             }
   125             // 'this' at index 0.
   125             // 'this' at index 0.
       
   126             if (values.get(0).getType() == BasicType.getTConflict()) {
       
   127               return null;
       
   128             }
   126             OopHandle handle = values.oopHandleAt(0);
   129             OopHandle handle = values.oopHandleAt(0);
   127             ObjectHeap heap = vm.saObjectHeap();
   130             ObjectHeap heap = vm.saObjectHeap();
   128             thisObject = vm.objectMirror(heap.newOop(handle));
   131             thisObject = vm.objectMirror(heap.newOop(handle));
   129         }
   132         }
   130         return thisObject;
   133         return thisObject;
   208 
   211 
   209     public List getArgumentValues() {
   212     public List getArgumentValues() {
   210         validateStackFrame();
   213         validateStackFrame();
   211         StackValueCollection values = saFrame.getLocals();
   214         StackValueCollection values = saFrame.getLocals();
   212         MethodImpl mmm = (MethodImpl)location.method();
   215         MethodImpl mmm = (MethodImpl)location.method();
       
   216         if (mmm.isNative())
       
   217             return null;
   213         List argSigs = mmm.argumentSignatures();
   218         List argSigs = mmm.argumentSignatures();
   214         int count = argSigs.size();
   219         int count = argSigs.size();
   215         List res = new ArrayList(0);
   220         List res = new ArrayList(0);
   216 
   221 
   217         int slot = mmm.isStatic()? 0 : 1;
   222         int slot = mmm.isStatic()? 0 : 1;
   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