comparison src/share/vm/classfile/resolutionErrors.hpp @ 2177:3582bf76420e

6990754: Use native memory and reference counting to implement SymbolTable Summary: move symbols from permgen into C heap and reference count them Reviewed-by: never, acorn, jmasa, stefank
author coleenp
date Thu, 27 Jan 2011 16:11:27 -0800
parents f95d63e2154a
children 1d1603768966
comparison
equal deleted inserted replaced
2176:27e4ea99855d 2177:3582bf76420e
31 class ResolutionErrorEntry; 31 class ResolutionErrorEntry;
32 32
33 // ResolutionError objects are used to record errors encountered during 33 // ResolutionError objects are used to record errors encountered during
34 // constant pool resolution (JVMS 5.4.3). 34 // constant pool resolution (JVMS 5.4.3).
35 35
36 class ResolutionErrorTable : public Hashtable { 36 class ResolutionErrorTable : public Hashtable<constantPoolOop> {
37 37
38 public: 38 public:
39 ResolutionErrorTable(int table_size); 39 ResolutionErrorTable(int table_size);
40 40
41 ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, symbolOop error); 41 ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, Symbol* error);
42 void free_entry(ResolutionErrorEntry *entry);
42 43
43 ResolutionErrorEntry* bucket(int i) { 44 ResolutionErrorEntry* bucket(int i) {
44 return (ResolutionErrorEntry*)Hashtable::bucket(i); 45 return (ResolutionErrorEntry*)Hashtable<constantPoolOop>::bucket(i);
45 } 46 }
46 47
47 ResolutionErrorEntry** bucket_addr(int i) { 48 ResolutionErrorEntry** bucket_addr(int i) {
48 return (ResolutionErrorEntry**)Hashtable::bucket_addr(i); 49 return (ResolutionErrorEntry**)Hashtable<constantPoolOop>::bucket_addr(i);
49 } 50 }
50 51
51 void add_entry(int index, ResolutionErrorEntry* new_entry) { 52 void add_entry(int index, ResolutionErrorEntry* new_entry) {
52 Hashtable::add_entry(index, (HashtableEntry*)new_entry); 53 Hashtable<constantPoolOop>::add_entry(index, (HashtableEntry<constantPoolOop>*)new_entry);
53 } 54 }
54 55
55 void add_entry(int index, unsigned int hash, 56 void add_entry(int index, unsigned int hash,
56 constantPoolHandle pool, int which, symbolHandle error); 57 constantPoolHandle pool, int which, Symbol* error);
57 58
58 59
59 // find error given the constant pool and constant pool index 60 // find error given the constant pool and constant pool index
60 ResolutionErrorEntry* find_entry(int index, unsigned int hash, 61 ResolutionErrorEntry* find_entry(int index, unsigned int hash,
61 constantPoolHandle pool, int cp_index); 62 constantPoolHandle pool, int cp_index);
66 } 67 }
67 68
68 // purges unloaded entries from the table 69 // purges unloaded entries from the table
69 void purge_resolution_errors(BoolObjectClosure* is_alive); 70 void purge_resolution_errors(BoolObjectClosure* is_alive);
70 71
71 // this table keeps symbolOops alive
72 void always_strong_classes_do(OopClosure* blk);
73
74 // GC support. 72 // GC support.
75 void oops_do(OopClosure* f); 73 void oops_do(OopClosure* f);
76 }; 74 };
77 75
78 76
79 class ResolutionErrorEntry : public HashtableEntry { 77 class ResolutionErrorEntry : public HashtableEntry<constantPoolOop> {
80 private: 78 private:
81 int _cp_index; 79 int _cp_index;
82 symbolOop _error; 80 Symbol* _error;
83 81
84 public: 82 public:
85 constantPoolOop pool() const { return (constantPoolOop)literal(); } 83 constantPoolOop pool() const { return (constantPoolOop)literal(); }
86 constantPoolOop* pool_addr() { return (constantPoolOop*)literal_addr(); } 84 constantPoolOop* pool_addr() { return (constantPoolOop*)literal_addr(); }
87 85
88 int cp_index() const { return _cp_index; } 86 int cp_index() const { return _cp_index; }
89 void set_cp_index(int cp_index) { _cp_index = cp_index; } 87 void set_cp_index(int cp_index) { _cp_index = cp_index; }
90 88
91 symbolOop error() const { return _error; } 89 Symbol* error() const { return _error; }
92 void set_error(symbolOop e) { _error = e; } 90 void set_error(Symbol* e);
93 symbolOop* error_addr() { return &_error; }
94 91
95 ResolutionErrorEntry* next() const { 92 ResolutionErrorEntry* next() const {
96 return (ResolutionErrorEntry*)HashtableEntry::next(); 93 return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop>::next();
97 } 94 }
98 95
99 ResolutionErrorEntry** next_addr() { 96 ResolutionErrorEntry** next_addr() {
100 return (ResolutionErrorEntry**)HashtableEntry::next_addr(); 97 return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop>::next_addr();
101 } 98 }
102 99
103 // GC support 100 // GC support
104 void oops_do(OopClosure* blk); 101 void oops_do(OopClosure* blk);
105 }; 102 };