6990754: Use native memory and reference counting to implement SymbolTable

Move symbols from permgen into C heap and reference count them

Reviewed-by: never, acorn, jmasa, stefank
This commit is contained in:
Coleen Phillimore 2011-01-27 16:11:27 -08:00
parent 950858350d
commit 7b4f8073f0
223 changed files with 3783 additions and 3641 deletions

View file

@ -33,27 +33,28 @@ class ResolutionErrorEntry;
// ResolutionError objects are used to record errors encountered during
// constant pool resolution (JVMS 5.4.3).
class ResolutionErrorTable : public Hashtable {
class ResolutionErrorTable : public Hashtable<constantPoolOop> {
public:
ResolutionErrorTable(int table_size);
ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, symbolOop error);
ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, Symbol* error);
void free_entry(ResolutionErrorEntry *entry);
ResolutionErrorEntry* bucket(int i) {
return (ResolutionErrorEntry*)Hashtable::bucket(i);
return (ResolutionErrorEntry*)Hashtable<constantPoolOop>::bucket(i);
}
ResolutionErrorEntry** bucket_addr(int i) {
return (ResolutionErrorEntry**)Hashtable::bucket_addr(i);
return (ResolutionErrorEntry**)Hashtable<constantPoolOop>::bucket_addr(i);
}
void add_entry(int index, ResolutionErrorEntry* new_entry) {
Hashtable::add_entry(index, (HashtableEntry*)new_entry);
Hashtable<constantPoolOop>::add_entry(index, (HashtableEntry<constantPoolOop>*)new_entry);
}
void add_entry(int index, unsigned int hash,
constantPoolHandle pool, int which, symbolHandle error);
constantPoolHandle pool, int which, Symbol* error);
// find error given the constant pool and constant pool index
@ -68,18 +69,15 @@ public:
// purges unloaded entries from the table
void purge_resolution_errors(BoolObjectClosure* is_alive);
// this table keeps symbolOops alive
void always_strong_classes_do(OopClosure* blk);
// GC support.
void oops_do(OopClosure* f);
};
class ResolutionErrorEntry : public HashtableEntry {
class ResolutionErrorEntry : public HashtableEntry<constantPoolOop> {
private:
int _cp_index;
symbolOop _error;
Symbol* _error;
public:
constantPoolOop pool() const { return (constantPoolOop)literal(); }
@ -88,16 +86,15 @@ class ResolutionErrorEntry : public HashtableEntry {
int cp_index() const { return _cp_index; }
void set_cp_index(int cp_index) { _cp_index = cp_index; }
symbolOop error() const { return _error; }
void set_error(symbolOop e) { _error = e; }
symbolOop* error_addr() { return &_error; }
Symbol* error() const { return _error; }
void set_error(Symbol* e);
ResolutionErrorEntry* next() const {
return (ResolutionErrorEntry*)HashtableEntry::next();
return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop>::next();
}
ResolutionErrorEntry** next_addr() {
return (ResolutionErrorEntry**)HashtableEntry::next_addr();
return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop>::next_addr();
}
// GC support