< prev index next >

src/hotspot/share/oops/constantPool.cpp

Print this page




 279     int rr_len = rr->length();
 280     for (int i = 0; i < rr_len; i++) {
 281       oop p = rr->obj_at(i);
 282       rr->obj_at_put(i, NULL);
 283       if (p != NULL && i < ref_map_len) {
 284         int index = object_to_cp_index(i);
 285         // Skip the entry if the string hash code is 0 since the string
 286         // is not included in the shared string_table, see StringTable::copy_shared_string.
 287         if (tag_at(index).is_string() && java_lang_String::hash_code(p) != 0) {
 288           oop op = StringTable::create_archived_string(p, THREAD);
 289           // If the String object is not archived (possibly too large),
 290           // NULL is returned. Also set it in the array, so we won't
 291           // have a 'bad' reference in the archived resolved_reference
 292           // array.
 293           rr->obj_at_put(i, op);
 294         }
 295       }
 296     }
 297 
 298     oop archived = MetaspaceShared::archive_heap_object(rr, THREAD);





 299     _cache->set_archived_references(archived);
 300     set_resolved_references(NULL);
 301   }
 302 }
 303 
 304 void ConstantPool::resolve_class_constants(TRAPS) {
 305   assert(DumpSharedSpaces, "used during dump time only");
 306   // The _cache may be NULL if the _pool_holder klass fails verification
 307   // at dump time due to missing dependencies.
 308   if (cache() == NULL || reference_map() == NULL) {
 309     return; // nothing to do
 310   }
 311 
 312   constantPoolHandle cp(THREAD, this);
 313   for (int index = 1; index < length(); index++) { // Index 0 is unused
 314     if (tag_at(index).is_string() && !cp->is_pseudo_string_at(index)) {
 315       int cache_index = cp->cp_to_object_index(index);
 316       string_at_impl(cp, index, cache_index, CHECK);
 317     }
 318   }




 279     int rr_len = rr->length();
 280     for (int i = 0; i < rr_len; i++) {
 281       oop p = rr->obj_at(i);
 282       rr->obj_at_put(i, NULL);
 283       if (p != NULL && i < ref_map_len) {
 284         int index = object_to_cp_index(i);
 285         // Skip the entry if the string hash code is 0 since the string
 286         // is not included in the shared string_table, see StringTable::copy_shared_string.
 287         if (tag_at(index).is_string() && java_lang_String::hash_code(p) != 0) {
 288           oop op = StringTable::create_archived_string(p, THREAD);
 289           // If the String object is not archived (possibly too large),
 290           // NULL is returned. Also set it in the array, so we won't
 291           // have a 'bad' reference in the archived resolved_reference
 292           // array.
 293           rr->obj_at_put(i, op);
 294         }
 295       }
 296     }
 297 
 298     oop archived = MetaspaceShared::archive_heap_object(rr, THREAD);
 299     // If the resolved references array is not archived (too large),
 300     // the 'archived' object is NULL. No need to explicitly check
 301     // the return value of archive_heap_object here. At runtime, the
 302     // resolved references will be created using the normal process
 303     // when there is no archived value.
 304     _cache->set_archived_references(archived);
 305     set_resolved_references(NULL);
 306   }
 307 }
 308 
 309 void ConstantPool::resolve_class_constants(TRAPS) {
 310   assert(DumpSharedSpaces, "used during dump time only");
 311   // The _cache may be NULL if the _pool_holder klass fails verification
 312   // at dump time due to missing dependencies.
 313   if (cache() == NULL || reference_map() == NULL) {
 314     return; // nothing to do
 315   }
 316 
 317   constantPoolHandle cp(THREAD, this);
 318   for (int index = 1; index < length(); index++) { // Index 0 is unused
 319     if (tag_at(index).is_string() && !cp->is_pseudo_string_at(index)) {
 320       int cache_index = cp->cp_to_object_index(index);
 321       string_at_impl(cp, index, cache_index, CHECK);
 322     }
 323   }


< prev index next >