32 |
32 |
33 // Placeholder objects. These represent classes currently |
33 // Placeholder objects. These represent classes currently |
34 // being loaded, as well as arrays of primitives. |
34 // being loaded, as well as arrays of primitives. |
35 // |
35 // |
36 |
36 |
37 class PlaceholderTable : public TwoOopHashtable<Symbol*> { |
37 class PlaceholderTable : public TwoOopHashtable<Symbol*, mtClass> { |
38 friend class VMStructs; |
38 friend class VMStructs; |
39 |
39 |
40 public: |
40 public: |
41 PlaceholderTable(int table_size); |
41 PlaceholderTable(int table_size); |
42 |
42 |
43 PlaceholderEntry* new_entry(int hash, Symbol* name, oop loader, bool havesupername, Symbol* supername); |
43 PlaceholderEntry* new_entry(int hash, Symbol* name, oop loader, bool havesupername, Symbol* supername); |
44 void free_entry(PlaceholderEntry* entry); |
44 void free_entry(PlaceholderEntry* entry); |
45 |
45 |
46 PlaceholderEntry* bucket(int i) { |
46 PlaceholderEntry* bucket(int i) { |
47 return (PlaceholderEntry*)Hashtable<Symbol*>::bucket(i); |
47 return (PlaceholderEntry*)Hashtable<Symbol*, mtClass>::bucket(i); |
48 } |
48 } |
49 |
49 |
50 PlaceholderEntry** bucket_addr(int i) { |
50 PlaceholderEntry** bucket_addr(int i) { |
51 return (PlaceholderEntry**)Hashtable<Symbol*>::bucket_addr(i); |
51 return (PlaceholderEntry**)Hashtable<Symbol*, mtClass>::bucket_addr(i); |
52 } |
52 } |
53 |
53 |
54 void add_entry(int index, PlaceholderEntry* new_entry) { |
54 void add_entry(int index, PlaceholderEntry* new_entry) { |
55 Hashtable<Symbol*>::add_entry(index, (HashtableEntry<Symbol*>*)new_entry); |
55 Hashtable<Symbol*, mtClass>::add_entry(index, (HashtableEntry<Symbol*, mtClass>*)new_entry); |
56 } |
56 } |
57 |
57 |
58 void add_entry(int index, unsigned int hash, Symbol* name, |
58 void add_entry(int index, unsigned int hash, Symbol* name, |
59 Handle loader, bool havesupername, Symbol* supername); |
59 Handle loader, bool havesupername, Symbol* supername); |
60 |
60 |
114 // For bootclasssearchpath, set before calling load_instance_class. |
114 // For bootclasssearchpath, set before calling load_instance_class. |
115 // Defining must be single threaded on a class/classloader basis |
115 // Defining must be single threaded on a class/classloader basis |
116 // For DEFINE_CLASS, the head of the queue owns the |
116 // For DEFINE_CLASS, the head of the queue owns the |
117 // define token and the rest of the threads wait to return the |
117 // define token and the rest of the threads wait to return the |
118 // result the first thread gets. |
118 // result the first thread gets. |
119 class SeenThread: public CHeapObj { |
119 class SeenThread: public CHeapObj<mtInternal> { |
120 private: |
120 private: |
121 Thread *_thread; |
121 Thread *_thread; |
122 SeenThread* _stnext; |
122 SeenThread* _stnext; |
123 SeenThread* _stprev; |
123 SeenThread* _stprev; |
124 public: |
124 public: |
150 // All threads examining the placeholder table must hold the |
150 // All threads examining the placeholder table must hold the |
151 // SystemDictionary_lock, so we don't need special precautions |
151 // SystemDictionary_lock, so we don't need special precautions |
152 // on store ordering here. |
152 // on store ordering here. |
153 // The system dictionary is the only user of this class. |
153 // The system dictionary is the only user of this class. |
154 |
154 |
155 class PlaceholderEntry : public HashtableEntry<Symbol*> { |
155 class PlaceholderEntry : public HashtableEntry<Symbol*, mtClass> { |
156 friend class VMStructs; |
156 friend class VMStructs; |
157 |
157 |
158 |
158 |
159 private: |
159 private: |
160 oop _loader; // initiating loader |
160 oop _loader; // initiating loader |
204 |
204 |
205 SeenThread* defineThreadQ() const { return _defineThreadQ; } |
205 SeenThread* defineThreadQ() const { return _defineThreadQ; } |
206 void set_defineThreadQ(SeenThread* SeenThread) { _defineThreadQ = SeenThread; } |
206 void set_defineThreadQ(SeenThread* SeenThread) { _defineThreadQ = SeenThread; } |
207 |
207 |
208 PlaceholderEntry* next() const { |
208 PlaceholderEntry* next() const { |
209 return (PlaceholderEntry*)HashtableEntry<Symbol*>::next(); |
209 return (PlaceholderEntry*)HashtableEntry<Symbol*, mtClass>::next(); |
210 } |
210 } |
211 |
211 |
212 PlaceholderEntry** next_addr() { |
212 PlaceholderEntry** next_addr() { |
213 return (PlaceholderEntry**)HashtableEntry<Symbol*>::next_addr(); |
213 return (PlaceholderEntry**)HashtableEntry<Symbol*, mtClass>::next_addr(); |
214 } |
214 } |
215 |
215 |
216 // Test for equality |
216 // Test for equality |
217 // Entries are unique for class/classloader name pair |
217 // Entries are unique for class/classloader name pair |
218 bool equals(Symbol* class_name, oop class_loader) const { |
218 bool equals(Symbol* class_name, oop class_loader) const { |