agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
Print this page
@@ -42,19 +42,26 @@
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("SymbolTable");
theTableField = type.getAddressField("_the_table");
+ sharedTableField = type.getAddressField("_shared_table");
}
// Fields
private static AddressField theTableField;
+ private static AddressField sharedTableField;
+
+ private CompactHashTable sharedTable;
// Accessors
public static SymbolTable getTheTable() {
Address tmp = theTableField.getValue();
- return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
+ SymbolTable table = (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
+ Address shared = sharedTableField.getStaticFieldAddress();
+ table.sharedTable = (CompactHashTable)VMObjectFactory.newObject(CompactHashTable.class, shared);
+ return table;
}
public SymbolTable(Address addr) {
super(addr);
}
@@ -74,20 +81,23 @@
/** Clone of VM's "temporary" probe routine, as the SA currently
does not support mutation so lookup() would have no effect
anyway. Returns null if the given string is not in the symbol
table. */
public Symbol probe(byte[] name) {
+ Symbol sym;
long hashValue = hashSymbol(name);
for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) {
if (e.hash() == hashValue) {
- Symbol sym = Symbol.create(e.literalValue());
+ sym = Symbol.create(e.literalValue());
if (sym.equals(name)) {
return sym;
}
}
}
- return null;
+
+ sym = sharedTable.probe(name, hashValue);
+ return sym;
}
public interface SymbolVisitor {
public void visit(Symbol sym);
}