equal
deleted
inserted
replaced
128 print(); |
128 print(); |
129 } |
129 } |
130 } |
130 } |
131 |
131 |
132 |
132 |
133 bool Dictionary::do_unloading() { |
133 void Dictionary::do_unloading() { |
134 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
134 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
135 bool class_was_unloaded = false; |
|
136 int index = 0; // Defined here for portability! Do not move |
|
137 |
135 |
138 // Remove unloadable entries and classes from system dictionary |
136 // Remove unloadable entries and classes from system dictionary |
139 // The placeholder array has been handled in always_strong_oops_do. |
137 // The placeholder array has been handled in always_strong_oops_do. |
140 DictionaryEntry* probe = NULL; |
138 DictionaryEntry* probe = NULL; |
141 for (index = 0; index < table_size(); index++) { |
139 for (int index = 0; index < table_size(); index++) { |
142 for (DictionaryEntry** p = bucket_addr(index); *p != NULL; ) { |
140 for (DictionaryEntry** p = bucket_addr(index); *p != NULL; ) { |
143 probe = *p; |
141 probe = *p; |
144 Klass* e = probe->klass(); |
142 Klass* e = probe->klass(); |
145 ClassLoaderData* loader_data = probe->loader_data(); |
143 ClassLoaderData* loader_data = probe->loader_data(); |
146 |
144 |
156 bool purge_entry = false; |
154 bool purge_entry = false; |
157 |
155 |
158 // Do we need to delete this system dictionary entry? |
156 // Do we need to delete this system dictionary entry? |
159 if (loader_data->is_unloading()) { |
157 if (loader_data->is_unloading()) { |
160 // If the loader is not live this entry should always be |
158 // If the loader is not live this entry should always be |
161 // removed (will never be looked up again). Note that this is |
159 // removed (will never be looked up again). |
162 // not the same as unloading the referred class. |
|
163 if (k_def_class_loader_data == loader_data) { |
|
164 // This is the defining entry, so the referred class is about |
|
165 // to be unloaded. |
|
166 class_was_unloaded = true; |
|
167 } |
|
168 // Also remove this system dictionary entry. |
|
169 purge_entry = true; |
160 purge_entry = true; |
170 |
|
171 } else { |
161 } else { |
172 // The loader in this entry is alive. If the klass is dead, |
162 // The loader in this entry is alive. If the klass is dead, |
173 // (determined by checking the defining class loader) |
163 // (determined by checking the defining class loader) |
174 // the loader must be an initiating loader (rather than the |
164 // the loader must be an initiating loader (rather than the |
175 // defining loader). Remove this entry. |
165 // defining loader). Remove this entry. |
194 } |
184 } |
195 } |
185 } |
196 p = probe->next_addr(); |
186 p = probe->next_addr(); |
197 } |
187 } |
198 } |
188 } |
199 return class_was_unloaded; |
|
200 } |
189 } |
201 |
190 |
202 void Dictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) { |
191 void Dictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) { |
203 // Skip the strong roots probe marking if the closures are the same. |
192 // Skip the strong roots probe marking if the closures are the same. |
204 if (strong == weak) { |
193 if (strong == weak) { |