symbolTable.hpp revision 3081
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "memory/allocation.inline.hpp"
#include "oops/symbol.hpp"
#include "utilities/hashtable.hpp"
// The symbol table holds all Symbol*s and corresponding interned strings.
// Symbol*s and literal strings should be canonicalized.
//
// The interned strings are created lazily.
//
// It is implemented as an open hash table with a fixed number of buckets.
//
// %note:
// - symbolTableEntrys are allocated in blocks to reduce the space overhead.
class BoolObjectClosure;
// Class to hold a newly created or referenced Symbol* temporarily in scope.
// new_symbol() and lookup() will create a Symbol* if not already in the
// symbol table and add to the symbol's reference count.
// probe() and lookup_only() will increment the refcount if symbol is found.
class TempNewSymbol : public StackObj {
public:
// Creating or looking up a symbol increments the symbol's reference count
// Operator= increments reference count.
void operator=(const TempNewSymbol &s) {
}
// Decrement reference counter so it can go away if it's unique
// Operators so they can be used like Symbols
// Sneaky conversion function
};
friend class VMStructs;
friend class ClassFileParser;
private:
// The symbol table
static SymbolTable* _the_table;
// For statistics
static int symbols_removed;
static int symbols_counted;
// Adding elements
unsigned int* hashValues, TRAPS);
int* cp_indices, unsigned int* hashValues,
TRAPS) {
}
// Table size
enum {
symbol_table_size = 20011
};
public:
enum {
};
// The symbol table
static void create_table() {
_the_table = new SymbolTable();
}
int number_of_entries) {
"bad shared symbol size.");
}
// lookup only, won't add. Also calculate hash.
// Only copy to C string to be added if lookup failed.
// Look up the address of the literal in the SymbolTable for this Symbol*
// jchar (utf16) version of lookups
unsigned int* hashValues, TRAPS);
// Release any dead symbols
static void unlink();
// iterate over symbols
// Symbol creation
}
}
}
// Symbol lookup
// Needed for preloading classes in signatures when compiling.
// Returns the symbol is already present in symbol table, otherwise
// NULL. NO ALLOCATION IS GUARANTEED!
unsigned int ignore_hash;
}
unsigned int ignore_hash;
}
// Histogram
static void print_histogram() PRODUCT_RETURN;
static void print() PRODUCT_RETURN;
// Debugging
static void verify();
// Sharing
}
}
}
};
friend class VMStructs;
private:
// The string table
static StringTable* _the_table;
sizeof (HashtableEntry<oop>)) {}
public:
// The string table
static void create_table() {
_the_table = new StringTable();
}
int number_of_entries) {
"bad shared string size.");
}
// GC support
// Delete pointers to otherwise-unreachable objects.
// Invoke "f->do_oop" on the locations of all oops in the table.
static void oops_do(OopClosure* f);
// Probing
// Interning
// Debugging
static void verify();
// Sharing
}
}
static void reverse() {
}
};
#endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP