255 set_resolved_references(NULL); |
255 set_resolved_references(NULL); |
256 return; |
256 return; |
257 } |
257 } |
258 |
258 |
259 objArrayOop rr = resolved_references(); |
259 objArrayOop rr = resolved_references(); |
|
260 Array<u2>* ref_map = reference_map(); |
260 if (rr != NULL) { |
261 if (rr != NULL) { |
261 for (int i = 0; i < rr->length(); i++) { |
262 int ref_map_len = ref_map == NULL ? 0 : ref_map->length(); |
|
263 int rr_len = rr->length(); |
|
264 for (int i = 0; i < rr_len; i++) { |
262 oop p = rr->obj_at(i); |
265 oop p = rr->obj_at(i); |
263 if (p != NULL) { |
266 rr->obj_at_put(i, NULL); |
|
267 if (p != NULL && i < ref_map_len) { |
264 int index = object_to_cp_index(i); |
268 int index = object_to_cp_index(i); |
265 // Skip the entry if the string hash code is 0 since the string |
269 // Skip the entry if the string hash code is 0 since the string |
266 // is not included in the shared string_table, see StringTable::copy_shared_string. |
270 // is not included in the shared string_table, see StringTable::copy_shared_string. |
267 if (tag_at(index).is_string() && java_lang_String::hash_code(p) != 0) { |
271 if (tag_at(index).is_string() && java_lang_String::hash_code(p) != 0) { |
268 oop op = StringTable::create_archived_string(p, THREAD); |
272 oop op = StringTable::create_archived_string(p, THREAD); |
269 // If the String object is not archived (possibly too large), |
273 // If the String object is not archived (possibly too large), |
270 // NULL is returned. Also set it in the array, so we won't |
274 // NULL is returned. Also set it in the array, so we won't |
271 // have a 'bad' reference in the archived resolved_reference |
275 // have a 'bad' reference in the archived resolved_reference |
272 // array. |
276 // array. |
273 rr->obj_at_put(i, op); |
277 rr->obj_at_put(i, op); |
274 } else { |
|
275 rr->obj_at_put(i, NULL); |
|
276 } |
278 } |
277 } |
279 } |
278 } |
280 } |
|
281 |
279 oop archived = MetaspaceShared::archive_heap_object(rr, THREAD); |
282 oop archived = MetaspaceShared::archive_heap_object(rr, THREAD); |
280 _cache->set_archived_references(archived); |
283 _cache->set_archived_references(archived); |
281 set_resolved_references(NULL); |
284 set_resolved_references(NULL); |
282 } |
285 } |
283 } |
286 } |
344 // Shared ConstantPools are in the RO region, so the _flags cannot be modified. |
347 // Shared ConstantPools are in the RO region, so the _flags cannot be modified. |
345 // The _on_stack flag is used to prevent ConstantPools from deallocation during |
348 // The _on_stack flag is used to prevent ConstantPools from deallocation during |
346 // class redefinition. Since shared ConstantPools cannot be deallocated anyway, |
349 // class redefinition. Since shared ConstantPools cannot be deallocated anyway, |
347 // we always set _on_stack to true to avoid having to change _flags during runtime. |
350 // we always set _on_stack to true to avoid having to change _flags during runtime. |
348 _flags |= (_on_stack | _is_shared); |
351 _flags |= (_on_stack | _is_shared); |
|
352 int num_klasses = 0; |
|
353 for (int index = 1; index < length(); index++) { // Index 0 is unused |
|
354 assert(!tag_at(index).is_unresolved_klass_in_error(), "This must not happen during dump time"); |
|
355 if (tag_at(index).is_klass()) { |
|
356 // This class was resolved as a side effect of executing Java code |
|
357 // during dump time. We need to restore it back to an UnresolvedClass, |
|
358 // so that the proper class loading and initialization can happen |
|
359 // at runtime. |
|
360 CPKlassSlot kslot = klass_slot_at(index); |
|
361 int resolved_klass_index = kslot.resolved_klass_index(); |
|
362 int name_index = kslot.name_index(); |
|
363 assert(tag_at(name_index).is_symbol(), "sanity"); |
|
364 resolved_klasses()->at_put(resolved_klass_index, NULL); |
|
365 tag_at_put(index, JVM_CONSTANT_UnresolvedClass); |
|
366 assert(klass_name_at(index) == symbol_at(name_index), "sanity"); |
|
367 } |
|
368 } |
|
369 if (cache() != NULL) { |
|
370 cache()->remove_unshareable_info(); |
|
371 } |
349 } |
372 } |
350 |
373 |
351 int ConstantPool::cp_to_object_index(int cp_index) { |
374 int ConstantPool::cp_to_object_index(int cp_index) { |
352 // this is harder don't do this so much. |
375 // this is harder don't do this so much. |
353 int i = reference_map()->find(cp_index); |
376 int i = reference_map()->find(cp_index); |