Mercurial > hg > truffle
diff agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | c18cbe5936b8 |
children | 32f7097f9d8f |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Thu Jan 27 13:42:28 2011 -0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Thu Jan 27 16:11:27 2011 -0800 @@ -740,7 +740,7 @@ for (Iterator itr = fields.iterator(); itr.hasNext();) { Field field = (Field) itr.next(); Symbol name = symTbl.probe(field.getID().getName()); - writeObjectID(name); + writeSymbolID(name); char typeCode = (char) field.getSignature().getByteAt(0); int kind = signatureToHprofKind(typeCode); out.writeByte((byte)kind); @@ -852,7 +852,7 @@ private void writeSymbol(Symbol sym) throws IOException { byte[] buf = sym.asString().getBytes("UTF-8"); writeHeader(HPROF_UTF8, buf.length + OBJ_ID_SIZE); - writeObjectID(sym); + writeSymbolID(sym); out.write(buf); } @@ -869,7 +869,7 @@ out.writeInt(serialNum); writeObjectID(clazz); out.writeInt(DUMMY_STACK_TRACE_ID); - writeObjectID(k.getName()); + writeSymbolID(k.getName()); serialNum++; } catch (IOException exp) { throw new RuntimeException(exp); @@ -901,6 +901,10 @@ writeObjectID(address); } + private void writeSymbolID(Symbol sym) throws IOException { + writeObjectID(getAddressValue(sym.getAddress())); + } + private void writeObjectID(long address) throws IOException { if (OBJ_ID_SIZE == 4) { out.writeInt((int) address);