agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 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); }
*** 71,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); } --- 78,102 ---- } } /** Clone of VM's "temporary" probe routine, as the SA currently does not support mutation so lookup() would have no effect ! anyway. Searches the regular symbol table and the shared symbol ! table. Null is returned if the given string is not in the symbol ! tables. */ 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 sharedTable.probe(name, hashValue); } public interface SymbolVisitor { public void visit(Symbol sym); }