hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
   572                                    }
   572                                    }
   573                                } catch (IOException exp) {
   573                                } catch (IOException exp) {
   574                                    throw new RuntimeException(exp);
   574                                    throw new RuntimeException(exp);
   575                                }
   575                                }
   576                            }
   576                            }
       
   577                            public void visitCompOopAddress(Address handleAddr) {
       
   578                              throw new RuntimeException(
       
   579                                    " Should not reach here. JNIHandles are not compressed \n");
       
   580                            }
   577                        });
   581                        });
   578             } catch (RuntimeException re) {
   582             } catch (RuntimeException re) {
   579                 handleRuntimeException(re);
   583                 handleRuntimeException(re);
   580             }
   584             }
   581         }
   585         }
   599         out.writeInt(DUMMY_STACK_TRACE_ID);
   603         out.writeInt(DUMMY_STACK_TRACE_ID);
   600         out.writeInt((int) array.getLength());
   604         out.writeInt((int) array.getLength());
   601         writeObjectID(array.getKlass().getJavaMirror());
   605         writeObjectID(array.getKlass().getJavaMirror());
   602         final int length = (int) array.getLength();
   606         final int length = (int) array.getLength();
   603         for (int index = 0; index < length; index++) {
   607         for (int index = 0; index < length; index++) {
   604             long offset = OBJECT_BASE_OFFSET + index * OBJ_ID_SIZE;
   608             OopHandle handle = array.getOopHandleAt(index);
   605             OopHandle handle = array.getHandle().getOopHandleAt(offset);
       
   606             writeObjectID(getAddressValue(handle));
   609             writeObjectID(getAddressValue(handle));
   607         }
   610         }
   608     }
   611     }
   609 
   612 
   610     protected void writePrimitiveArray(TypeArray array) throws IOException {
   613     protected void writePrimitiveArray(TypeArray array) throws IOException {
   801         case JVM_SIGNATURE_DOUBLE:
   804         case JVM_SIGNATURE_DOUBLE:
   802             out.writeDouble(((DoubleField)field).getValue(oop));
   805             out.writeDouble(((DoubleField)field).getValue(oop));
   803             break;
   806             break;
   804         case JVM_SIGNATURE_CLASS:
   807         case JVM_SIGNATURE_CLASS:
   805         case JVM_SIGNATURE_ARRAY: {
   808         case JVM_SIGNATURE_ARRAY: {
   806             OopHandle handle = ((OopField)field).getValueAsOopHandle(oop);
   809             if (VM.getVM().isCompressedOopsEnabled()) {
   807             writeObjectID(getAddressValue(handle));
   810               OopHandle handle = ((NarrowOopField)field).getValueAsOopHandle(oop);
       
   811               writeObjectID(getAddressValue(handle));
       
   812             } else {
       
   813               OopHandle handle = ((OopField)field).getValueAsOopHandle(oop);
       
   814               writeObjectID(getAddressValue(handle));
       
   815             }
   808             break;
   816             break;
   809         }
   817         }
   810         default:
   818         default:
   811             throw new RuntimeException("should not reach here");
   819             throw new RuntimeException("should not reach here");
   812         }
   820         }