src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java
equal
deleted
inserted
replaced
1096 } |
1096 } |
1097 |
1097 |
1098 private void writeSymbol(Symbol sym) throws IOException { |
1098 private void writeSymbol(Symbol sym) throws IOException { |
1099 // If name is already written don't write it again. |
1099 // If name is already written don't write it again. |
1100 if (names.add(sym)) { |
1100 if (names.add(sym)) { |
1101 byte[] buf = sym.asString().getBytes("UTF-8"); |
1101 if(sym != null) { |
1102 writeHeader(HPROF_UTF8, buf.length + OBJ_ID_SIZE); |
1102 byte[] buf = sym.asString().getBytes("UTF-8"); |
1103 writeSymbolID(sym); |
1103 writeHeader(HPROF_UTF8, buf.length + OBJ_ID_SIZE); |
1104 out.write(buf); |
1104 writeSymbolID(sym); |
|
1105 out.write(buf); |
|
1106 } else { |
|
1107 writeHeader(HPROF_UTF8, 0 + OBJ_ID_SIZE); |
|
1108 writeSymbolID(null); |
|
1109 } |
1105 } |
1110 } |
1106 } |
1111 } |
1107 |
1112 |
1108 private void writeClasses() throws IOException { |
1113 private void writeClasses() throws IOException { |
1109 // write class list (id, name) association |
1114 // write class list (id, name) association |
1150 writeObjectID(address); |
1155 writeObjectID(address); |
1151 } |
1156 } |
1152 |
1157 |
1153 private void writeSymbolID(Symbol sym) throws IOException { |
1158 private void writeSymbolID(Symbol sym) throws IOException { |
1154 assert names.contains(sym); |
1159 assert names.contains(sym); |
1155 writeObjectID(getAddressValue(sym.getAddress())); |
1160 long address = (sym != null) ? getAddressValue(sym.getAddress()) : getAddressValue(null); |
|
1161 writeObjectID(address); |
1156 } |
1162 } |
1157 |
1163 |
1158 private void writeObjectID(long address) throws IOException { |
1164 private void writeObjectID(long address) throws IOException { |
1159 if (OBJ_ID_SIZE == 4) { |
1165 if (OBJ_ID_SIZE == 4) { |
1160 out.writeInt((int) address); |
1166 out.writeInt((int) address); |