agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java
Print this page
*** 42,60 ****
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("SymbolTable");
theTableField = type.getAddressField("_the_table");
}
// Fields
private static AddressField theTableField;
// Accessors
public static SymbolTable getTheTable() {
Address tmp = theTableField.getValue();
! return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
}
public SymbolTable(Address addr) {
super(addr);
}
--- 42,67 ----
}
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();
! 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,93 ****
/** 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) {
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());
if (sym.equals(name)) {
return sym;
}
}
}
! return null;
}
public interface SymbolVisitor {
public void visit(Symbol sym);
}
--- 81,103 ----
/** 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) {
! sym = Symbol.create(e.literalValue());
if (sym.equals(name)) {
return sym;
}
}
}
!
! sym = sharedTable.probe(name, hashValue);
! return sym;
}
public interface SymbolVisitor {
public void visit(Symbol sym);
}