62 #include "runtime/vmThread.hpp" |
62 #include "runtime/vmThread.hpp" |
63 #include "runtime/vm_operations.hpp" |
63 #include "runtime/vm_operations.hpp" |
64 #include "utilities/align.hpp" |
64 #include "utilities/align.hpp" |
65 #include "utilities/bitMap.hpp" |
65 #include "utilities/bitMap.hpp" |
66 #include "utilities/defaultStream.hpp" |
66 #include "utilities/defaultStream.hpp" |
67 #include "utilities/hashtable.inline.hpp" |
|
68 #if INCLUDE_G1GC |
67 #if INCLUDE_G1GC |
69 #include "gc/g1/g1CollectedHeap.hpp" |
68 #include "gc/g1/g1CollectedHeap.hpp" |
70 #endif |
69 #endif |
71 |
70 |
72 ReservedSpace MetaspaceShared::_shared_rs; |
71 ReservedSpace MetaspaceShared::_shared_rs; |
122 assert(newtop >= _top, "must not grow backwards"); |
121 assert(newtop >= _top, "must not grow backwards"); |
123 if (newtop > _end) { |
122 if (newtop > _end) { |
124 MetaspaceShared::report_out_of_space(_name, newtop - _top); |
123 MetaspaceShared::report_out_of_space(_name, newtop - _top); |
125 ShouldNotReachHere(); |
124 ShouldNotReachHere(); |
126 } |
125 } |
|
126 uintx delta = MetaspaceShared::object_delta_uintx(newtop); |
|
127 if (delta > MAX_SHARED_DELTA) { |
|
128 // This is just a sanity check and should not appear in any real world usage. This |
|
129 // happens only if you allocate more than 2GB of shared objects and would require |
|
130 // millions of shared classes. |
|
131 vm_exit_during_initialization("Out of memory in the CDS archive", |
|
132 "Please reduce the number of shared classes."); |
|
133 } |
|
134 |
127 MetaspaceShared::commit_shared_space_to(newtop); |
135 MetaspaceShared::commit_shared_space_to(newtop); |
128 _top = newtop; |
136 _top = newtop; |
129 return _top; |
137 return _top; |
130 } |
138 } |
131 |
139 |
321 if (!_shared_vs.initialize(_shared_rs, 0)) { |
329 if (!_shared_vs.initialize(_shared_rs, 0)) { |
322 vm_exit_during_initialization("Unable to allocate memory for shared space"); |
330 vm_exit_during_initialization("Unable to allocate memory for shared space"); |
323 } |
331 } |
324 |
332 |
325 _mc_region.init(&_shared_rs); |
333 _mc_region.init(&_shared_rs); |
|
334 SharedBaseAddress = (size_t)_shared_rs.base(); |
326 tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT, |
335 tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT, |
327 _shared_rs.size(), p2i(_shared_rs.base())); |
336 _shared_rs.size(), p2i(_shared_rs.base())); |
328 } |
337 } |
329 |
338 |
330 // Called by universe_post_init() |
339 // Called by universe_post_init() |
414 |
423 |
415 // Dump/restore the symbol/string/subgraph_info tables |
424 // Dump/restore the symbol/string/subgraph_info tables |
416 SymbolTable::serialize_shared_table_header(soc); |
425 SymbolTable::serialize_shared_table_header(soc); |
417 StringTable::serialize_shared_table_header(soc); |
426 StringTable::serialize_shared_table_header(soc); |
418 HeapShared::serialize_subgraph_info_table_header(soc); |
427 HeapShared::serialize_subgraph_info_table_header(soc); |
|
428 SystemDictionaryShared::serialize_dictionary_headers(soc); |
419 |
429 |
420 JavaClasses::serialize_offsets(soc); |
430 JavaClasses::serialize_offsets(soc); |
421 InstanceMirrorKlass::serialize_offsets(soc); |
431 InstanceMirrorKlass::serialize_offsets(soc); |
422 soc->do_tag(--tag); |
432 soc->do_tag(--tag); |
423 |
433 |
462 } |
472 } |
463 } |
473 } |
464 |
474 |
465 class CollectClassesClosure : public KlassClosure { |
475 class CollectClassesClosure : public KlassClosure { |
466 void do_klass(Klass* k) { |
476 void do_klass(Klass* k) { |
467 if (!(k->is_instance_klass() && InstanceKlass::cast(k)->is_in_error_state())) { |
477 if (k->is_instance_klass() && |
468 if (k->is_instance_klass() && InstanceKlass::cast(k)->signers() != NULL) { |
478 SystemDictionaryShared::is_excluded_class(InstanceKlass::cast(k))) { |
469 // Mark any class with signers and don't add to the _global_klass_objects |
479 // Don't add to the _global_klass_objects |
470 k->set_has_signer_and_not_archived(); |
480 } else { |
471 } else { |
481 _global_klass_objects->append_if_missing(k); |
472 _global_klass_objects->append_if_missing(k); |
|
473 } |
|
474 } |
482 } |
475 if (k->is_array_klass()) { |
483 if (k->is_array_klass()) { |
476 // Add in the array classes too |
484 // Add in the array classes too |
477 ArrayKlass* ak = ArrayKlass::cast(k); |
485 ArrayKlass* ak = ArrayKlass::cast(k); |
478 Klass* h = ak->higher_dimension(); |
486 Klass* h = ak->higher_dimension(); |
574 ik->set_archived_class_data(q); |
582 ik->set_archived_class_data(q); |
575 } |
583 } |
576 } |
584 } |
577 } |
585 } |
578 } |
586 } |
579 |
|
580 NOT_PRODUCT( |
|
581 static void assert_not_unsafe_anonymous_class(InstanceKlass* k) { |
|
582 assert(!(k->is_unsafe_anonymous()), "cannot archive unsafe anonymous classes"); |
|
583 } |
|
584 |
|
585 // Unsafe anonymous classes are not stored inside any dictionaries. |
|
586 static void assert_no_unsafe_anonymous_classes_in_dictionaries() { |
|
587 ClassLoaderDataGraph::dictionary_classes_do(assert_not_unsafe_anonymous_class); |
|
588 }) |
|
589 |
587 |
590 // Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables. |
588 // Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables. |
591 // (In GCC this is the field <Type>::_vptr, i.e., first word in the object.) |
589 // (In GCC this is the field <Type>::_vptr, i.e., first word in the object.) |
592 // |
590 // |
593 // Addresses of the vtables and the methods may be different across JVM runs, |
591 // Addresses of the vtables and the methods may be different across JVM runs, |
1121 oldtop = _ro_region.top(); |
1119 oldtop = _ro_region.top(); |
1122 p = _ro_region.allocate(bytes, alignment); |
1120 p = _ro_region.allocate(bytes, alignment); |
1123 newtop = _ro_region.top(); |
1121 newtop = _ro_region.top(); |
1124 } else { |
1122 } else { |
1125 oldtop = _rw_region.top(); |
1123 oldtop = _rw_region.top(); |
|
1124 if (ref->msotype() == MetaspaceObj::ClassType) { |
|
1125 // Save a pointer immediate in front of an InstanceKlass, so |
|
1126 // we can do a quick lookup from InstanceKlass* -> RunTimeSharedClassInfo* |
|
1127 // without building another hashtable. See RunTimeSharedClassInfo::get_for() |
|
1128 // in systemDictionaryShared.cpp. |
|
1129 Klass* klass = (Klass*)obj; |
|
1130 if (klass->is_instance_klass()) { |
|
1131 SystemDictionaryShared::validate_before_archiving(InstanceKlass::cast(klass)); |
|
1132 _rw_region.allocate(sizeof(address), BytesPerWord); |
|
1133 } |
|
1134 } |
1126 p = _rw_region.allocate(bytes, alignment); |
1135 p = _rw_region.allocate(bytes, alignment); |
1127 newtop = _rw_region.top(); |
1136 newtop = _rw_region.top(); |
1128 } |
1137 } |
1129 memcpy(p, obj, bytes); |
1138 memcpy(p, obj, bytes); |
1130 bool isnew = _new_loc_table->put(obj, (address)p); |
1139 bool isnew = _new_loc_table->put(obj, (address)p); |
1131 log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); |
1140 log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); |
1132 assert(isnew, "must be"); |
1141 assert(isnew, "must be"); |
1133 |
1142 |
1134 _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only); |
1143 _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only); |
1135 if (ref->msotype() == MetaspaceObj::SymbolType) { |
|
1136 uintx delta = MetaspaceShared::object_delta(p); |
|
1137 if (delta > MAX_SHARED_DELTA) { |
|
1138 // This is just a sanity check and should not appear in any real world usage. This |
|
1139 // happens only if you allocate more than 2GB of Symbols and would require |
|
1140 // millions of shared classes. |
|
1141 vm_exit_during_initialization("Too many Symbols in the CDS archive", |
|
1142 "Please reduce the number of shared classes."); |
|
1143 } |
|
1144 } |
|
1145 } |
1144 } |
1146 |
1145 |
1147 static address get_new_loc(MetaspaceClosure::Ref* ref) { |
1146 static address get_new_loc(MetaspaceClosure::Ref* ref) { |
1148 address* pp = _new_loc_table->get(ref->obj()); |
1147 address* pp = _new_loc_table->get(ref->obj()); |
1149 assert(pp != NULL, "must be"); |
1148 assert(pp != NULL, "must be"); |
1279 // NOTE -- this requires that the vtable is NOT yet patched, or else we are hosed. |
1278 // NOTE -- this requires that the vtable is NOT yet patched, or else we are hosed. |
1280 it->push(_global_klass_objects->adr_at(i)); |
1279 it->push(_global_klass_objects->adr_at(i)); |
1281 } |
1280 } |
1282 } |
1281 } |
1283 FileMapInfo::metaspace_pointers_do(it); |
1282 FileMapInfo::metaspace_pointers_do(it); |
1284 SystemDictionary::classes_do(it); |
1283 SystemDictionaryShared::dumptime_classes_do(it); |
1285 Universe::metaspace_pointers_do(it); |
1284 Universe::metaspace_pointers_do(it); |
1286 SymbolTable::metaspace_pointers_do(it); |
1285 SymbolTable::metaspace_pointers_do(it); |
1287 vmSymbols::metaspace_pointers_do(it); |
1286 vmSymbols::metaspace_pointers_do(it); |
1288 } |
1287 } |
1289 |
1288 |
1313 SymbolTable::write_to_archive(); |
1312 SymbolTable::write_to_archive(); |
1314 } |
1313 } |
1315 |
1314 |
1316 char* VM_PopulateDumpSharedSpace::dump_read_only_tables() { |
1315 char* VM_PopulateDumpSharedSpace::dump_read_only_tables() { |
1317 ArchiveCompactor::OtherROAllocMark mark; |
1316 ArchiveCompactor::OtherROAllocMark mark; |
1318 // Reorder the system dictionary. Moving the symbols affects |
|
1319 // how the hash table indices are calculated. |
|
1320 SystemDictionary::reorder_dictionary_for_sharing(); |
|
1321 |
1317 |
1322 tty->print("Removing java_mirror ... "); |
1318 tty->print("Removing java_mirror ... "); |
1323 if (!HeapShared::is_heap_object_archiving_allowed()) { |
1319 if (!HeapShared::is_heap_object_archiving_allowed()) { |
1324 clear_basic_type_mirrors(); |
1320 clear_basic_type_mirrors(); |
1325 } |
1321 } |
1326 remove_java_mirror_in_classes(); |
1322 remove_java_mirror_in_classes(); |
1327 tty->print_cr("done. "); |
1323 tty->print_cr("done. "); |
1328 NOT_PRODUCT(SystemDictionary::verify();) |
1324 |
1329 |
1325 SystemDictionaryShared::write_to_archive(); |
1330 size_t buckets_bytes = SystemDictionary::count_bytes_for_buckets(); |
1326 |
1331 char* buckets_top = _ro_region.allocate(buckets_bytes, sizeof(intptr_t)); |
1327 char* start = _ro_region.top(); |
1332 SystemDictionary::copy_buckets(buckets_top, _ro_region.top()); |
|
1333 |
|
1334 size_t table_bytes = SystemDictionary::count_bytes_for_table(); |
|
1335 char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t)); |
|
1336 SystemDictionary::copy_table(table_top, _ro_region.top()); |
|
1337 |
1328 |
1338 // Write the other data to the output array. |
1329 // Write the other data to the output array. |
1339 WriteClosure wc(&_ro_region); |
1330 WriteClosure wc(&_ro_region); |
1340 MetaspaceShared::serialize(&wc); |
1331 MetaspaceShared::serialize(&wc); |
1341 |
1332 |
1342 // Write the bitmaps for patching the archive heap regions |
1333 // Write the bitmaps for patching the archive heap regions |
1343 dump_archive_heap_oopmaps(); |
1334 dump_archive_heap_oopmaps(); |
1344 |
1335 |
1345 return buckets_top; |
1336 return start; |
1346 } |
1337 } |
1347 |
1338 |
1348 void VM_PopulateDumpSharedSpace::doit() { |
1339 void VM_PopulateDumpSharedSpace::doit() { |
1349 // We should no longer allocate anything from the metaspace, so that: |
1340 // We should no longer allocate anything from the metaspace, so that: |
1350 // |
1341 // |
1365 // shared classes at runtime, where constraints were previously created. |
1356 // shared classes at runtime, where constraints were previously created. |
1366 guarantee(SystemDictionary::constraints()->number_of_entries() == 0, |
1357 guarantee(SystemDictionary::constraints()->number_of_entries() == 0, |
1367 "loader constraints are not saved"); |
1358 "loader constraints are not saved"); |
1368 guarantee(SystemDictionary::placeholders()->number_of_entries() == 0, |
1359 guarantee(SystemDictionary::placeholders()->number_of_entries() == 0, |
1369 "placeholders are not saved"); |
1360 "placeholders are not saved"); |
1370 // Revisit and implement this if we prelink method handle call sites: |
|
1371 guarantee(SystemDictionary::invoke_method_table() == NULL || |
|
1372 SystemDictionary::invoke_method_table()->number_of_entries() == 0, |
|
1373 "invoke method table is not saved"); |
|
1374 |
1361 |
1375 // At this point, many classes have been loaded. |
1362 // At this point, many classes have been loaded. |
1376 // Gather systemDictionary classes in a global array and do everything to |
1363 // Gather systemDictionary classes in a global array and do everything to |
1377 // that so we don't have to walk the SystemDictionary again. |
1364 // that so we don't have to walk the SystemDictionary again. |
|
1365 SystemDictionaryShared::check_excluded_classes(); |
1378 _global_klass_objects = new GrowableArray<Klass*>(1000); |
1366 _global_klass_objects = new GrowableArray<Klass*>(1000); |
1379 CollectClassesClosure collect_classes; |
1367 CollectClassesClosure collect_classes; |
1380 ClassLoaderDataGraph::loaded_classes_do(&collect_classes); |
1368 ClassLoaderDataGraph::loaded_classes_do(&collect_classes); |
1381 |
1369 |
1382 tty->print_cr("Number of classes %d", _global_klass_objects->length()); |
1370 tty->print_cr("Number of classes %d", _global_klass_objects->length()); |
1401 // Ensure the ConstMethods won't be modified at run-time |
1389 // Ensure the ConstMethods won't be modified at run-time |
1402 tty->print("Updating ConstMethods ... "); |
1390 tty->print("Updating ConstMethods ... "); |
1403 rewrite_nofast_bytecodes_and_calculate_fingerprints(); |
1391 rewrite_nofast_bytecodes_and_calculate_fingerprints(); |
1404 tty->print_cr("done. "); |
1392 tty->print_cr("done. "); |
1405 |
1393 |
1406 // Move classes from platform/system dictionaries into the boot dictionary |
|
1407 SystemDictionary::combine_shared_dictionaries(); |
|
1408 |
|
1409 // Make sure all classes have a correct loader type. |
|
1410 ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(MetaspaceShared::check_shared_class_loader_type); |
|
1411 |
|
1412 // Remove all references outside the metadata |
1394 // Remove all references outside the metadata |
1413 tty->print("Removing unshareable information ... "); |
1395 tty->print("Removing unshareable information ... "); |
1414 remove_unshareable_in_classes(); |
1396 remove_unshareable_in_classes(); |
1415 tty->print_cr("done. "); |
1397 tty->print_cr("done. "); |
1416 |
|
1417 // We don't support archiving unsafe anonymous classes. Verify that they are not stored in |
|
1418 // any dictionaries. |
|
1419 NOT_PRODUCT(assert_no_unsafe_anonymous_classes_in_dictionaries()); |
|
1420 |
1398 |
1421 ArchiveCompactor::initialize(); |
1399 ArchiveCompactor::initialize(); |
1422 ArchiveCompactor::copy_and_compact(); |
1400 ArchiveCompactor::copy_and_compact(); |
1423 |
1401 |
1424 dump_symbols(); |
1402 dump_symbols(); |
1464 mapinfo->set_cds_i2i_entry_code_buffers(MetaspaceShared::cds_i2i_entry_code_buffers()); |
1442 mapinfo->set_cds_i2i_entry_code_buffers(MetaspaceShared::cds_i2i_entry_code_buffers()); |
1465 mapinfo->set_cds_i2i_entry_code_buffers_size(MetaspaceShared::cds_i2i_entry_code_buffers_size()); |
1443 mapinfo->set_cds_i2i_entry_code_buffers_size(MetaspaceShared::cds_i2i_entry_code_buffers_size()); |
1466 mapinfo->set_core_spaces_size(core_spaces_size); |
1444 mapinfo->set_core_spaces_size(core_spaces_size); |
1467 |
1445 |
1468 for (int pass=1; pass<=2; pass++) { |
1446 for (int pass=1; pass<=2; pass++) { |
|
1447 bool print_archive_log = (pass==1); |
1469 if (pass == 1) { |
1448 if (pass == 1) { |
1470 // The first pass doesn't actually write the data to disk. All it |
1449 // The first pass doesn't actually write the data to disk. All it |
1471 // does is to update the fields in the mapinfo->_header. |
1450 // does is to update the fields in the mapinfo->_header. |
1472 } else { |
1451 } else { |
1473 // After the first pass, the contents of mapinfo->_header are finalized, |
1452 // After the first pass, the contents of mapinfo->_header are finalized, |
1488 |
1467 |
1489 _total_closed_archive_region_size = mapinfo->write_archive_heap_regions( |
1468 _total_closed_archive_region_size = mapinfo->write_archive_heap_regions( |
1490 _closed_archive_heap_regions, |
1469 _closed_archive_heap_regions, |
1491 _closed_archive_heap_oopmaps, |
1470 _closed_archive_heap_oopmaps, |
1492 MetaspaceShared::first_closed_archive_heap_region, |
1471 MetaspaceShared::first_closed_archive_heap_region, |
1493 MetaspaceShared::max_closed_archive_heap_region); |
1472 MetaspaceShared::max_closed_archive_heap_region, |
|
1473 print_archive_log); |
1494 _total_open_archive_region_size = mapinfo->write_archive_heap_regions( |
1474 _total_open_archive_region_size = mapinfo->write_archive_heap_regions( |
1495 _open_archive_heap_regions, |
1475 _open_archive_heap_regions, |
1496 _open_archive_heap_oopmaps, |
1476 _open_archive_heap_oopmaps, |
1497 MetaspaceShared::first_open_archive_heap_region, |
1477 MetaspaceShared::first_open_archive_heap_region, |
1498 MetaspaceShared::max_open_archive_heap_region); |
1478 MetaspaceShared::max_open_archive_heap_region, |
|
1479 print_archive_log); |
1499 } |
1480 } |
1500 |
1481 |
1501 mapinfo->close(); |
1482 mapinfo->close(); |
1502 |
1483 |
1503 // Restore the vtable in case we invoke any virtual methods. |
1484 // Restore the vtable in case we invoke any virtual methods. |
1606 _made_progress = true; |
1587 _made_progress = true; |
1607 } |
1588 } |
1608 } |
1589 } |
1609 }; |
1590 }; |
1610 |
1591 |
1611 void MetaspaceShared::check_shared_class_loader_type(InstanceKlass* ik) { |
|
1612 ResourceMark rm; |
|
1613 if (ik->shared_classpath_index() == UNREGISTERED_INDEX) { |
|
1614 guarantee(ik->loader_type() == 0, |
|
1615 "Class loader type must not be set for this class %s", ik->name()->as_C_string()); |
|
1616 } else { |
|
1617 guarantee(ik->loader_type() != 0, |
|
1618 "Class loader type must be set for this class %s", ik->name()->as_C_string()); |
|
1619 } |
|
1620 } |
|
1621 |
|
1622 void MetaspaceShared::link_and_cleanup_shared_classes(TRAPS) { |
1592 void MetaspaceShared::link_and_cleanup_shared_classes(TRAPS) { |
1623 // We need to iterate because verification may cause additional classes |
1593 // We need to iterate because verification may cause additional classes |
1624 // to be loaded. |
1594 // to be loaded. |
1625 LinkSharedClassesClosure link_closure(THREAD); |
1595 LinkSharedClassesClosure link_closure(THREAD); |
1626 do { |
1596 do { |
1637 // we should come here only if there are unverifiable classes, which |
1607 // we should come here only if there are unverifiable classes, which |
1638 // shouldn't happen in normal cases. So better safe than sorry. |
1608 // shouldn't happen in normal cases. So better safe than sorry. |
1639 check_closure.reset(); |
1609 check_closure.reset(); |
1640 ClassLoaderDataGraph::unlocked_loaded_classes_do(&check_closure); |
1610 ClassLoaderDataGraph::unlocked_loaded_classes_do(&check_closure); |
1641 } while (check_closure.made_progress()); |
1611 } while (check_closure.made_progress()); |
1642 |
|
1643 // Unverifiable classes will not be included in the CDS archive. |
|
1644 SystemDictionary::remove_classes_in_error_state(); |
|
1645 } |
1612 } |
1646 } |
1613 } |
1647 |
1614 |
1648 void MetaspaceShared::prepare_for_dumping() { |
1615 void MetaspaceShared::prepare_for_dumping() { |
1649 Arguments::check_unsupported_dumping_properties(); |
1616 Arguments::check_unsupported_dumping_properties(); |
1715 // fails verification, all other interfaces that were not specified in the classlist but |
1682 // fails verification, all other interfaces that were not specified in the classlist but |
1716 // are implemented by K are not verified. |
1683 // are implemented by K are not verified. |
1717 link_and_cleanup_shared_classes(CATCH); |
1684 link_and_cleanup_shared_classes(CATCH); |
1718 tty->print_cr("Rewriting and linking classes: done"); |
1685 tty->print_cr("Rewriting and linking classes: done"); |
1719 |
1686 |
1720 SystemDictionary::clear_invoke_method_table(); |
|
1721 |
|
1722 SystemDictionaryShared::finalize_verification_constraints(); |
|
1723 |
|
1724 VM_PopulateDumpSharedSpace op; |
1687 VM_PopulateDumpSharedSpace op; |
1725 VMThread::execute(&op); |
1688 VMThread::execute(&op); |
1726 } |
1689 } |
1727 } |
1690 } |
1728 |
1691 |
1729 |
1692 |
1730 int MetaspaceShared::preload_classes(const char* class_list_path, TRAPS) { |
1693 int MetaspaceShared::preload_classes(const char* class_list_path, TRAPS) { |
1731 ClassListParser parser(class_list_path); |
1694 ClassListParser parser(class_list_path); |
1732 int class_count = 0; |
1695 int class_count = 0; |
1733 |
1696 |
1734 while (parser.parse_one_line()) { |
1697 while (parser.parse_one_line()) { |
1735 Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD); |
1698 Klass* klass = parser.load_current_class(THREAD); |
1736 if (HAS_PENDING_EXCEPTION) { |
1699 if (HAS_PENDING_EXCEPTION) { |
1737 if (klass == NULL && |
1700 if (klass == NULL && |
1738 (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) { |
1701 (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) { |
1739 // print a warning only when the pending exception is class not found |
1702 // print a warning only when the pending exception is class not found |
1740 tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name()); |
1703 tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name()); |
1741 } |
|
1742 CLEAR_PENDING_EXCEPTION; |
|
1743 } |
1704 } |
1744 if (klass != NULL) { |
1705 CLEAR_PENDING_EXCEPTION; |
1745 if (log_is_enabled(Trace, cds)) { |
1706 } |
1746 ResourceMark rm; |
1707 if (klass != NULL) { |
1747 log_trace(cds)("Shared spaces preloaded: %s", klass->external_name()); |
1708 if (log_is_enabled(Trace, cds)) { |
1748 } |
1709 ResourceMark rm; |
1749 |
1710 log_trace(cds)("Shared spaces preloaded: %s", klass->external_name()); |
1750 if (klass->is_instance_klass()) { |
|
1751 InstanceKlass* ik = InstanceKlass::cast(klass); |
|
1752 |
|
1753 // Link the class to cause the bytecodes to be rewritten and the |
|
1754 // cpcache to be created. The linking is done as soon as classes |
|
1755 // are loaded in order that the related data structures (klass and |
|
1756 // cpCache) are located together. |
|
1757 try_link_class(ik, THREAD); |
|
1758 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); |
|
1759 } |
|
1760 |
|
1761 class_count++; |
|
1762 } |
1711 } |
1763 } |
1712 |
|
1713 if (klass->is_instance_klass()) { |
|
1714 InstanceKlass* ik = InstanceKlass::cast(klass); |
|
1715 |
|
1716 // Link the class to cause the bytecodes to be rewritten and the |
|
1717 // cpcache to be created. The linking is done as soon as classes |
|
1718 // are loaded in order that the related data structures (klass and |
|
1719 // cpCache) are located together. |
|
1720 try_link_class(ik, THREAD); |
|
1721 guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class"); |
|
1722 } |
|
1723 |
|
1724 class_count++; |
|
1725 } |
|
1726 } |
1764 |
1727 |
1765 return class_count; |
1728 return class_count; |
1766 } |
1729 } |
1767 |
1730 |
1768 // Returns true if the class's status has changed |
1731 // Returns true if the class's status has changed |
1992 char* buffer = mapinfo->misc_data_patching_start(); |
1955 char* buffer = mapinfo->misc_data_patching_start(); |
1993 clone_cpp_vtables((intptr_t*)buffer); |
1956 clone_cpp_vtables((intptr_t*)buffer); |
1994 |
1957 |
1995 // The rest of the data is now stored in the RW region |
1958 // The rest of the data is now stored in the RW region |
1996 buffer = mapinfo->read_only_tables_start(); |
1959 buffer = mapinfo->read_only_tables_start(); |
1997 int sharedDictionaryLen = *(intptr_t*)buffer; |
|
1998 buffer += sizeof(intptr_t); |
|
1999 int number_of_entries = *(intptr_t*)buffer; |
|
2000 buffer += sizeof(intptr_t); |
|
2001 SystemDictionary::set_shared_dictionary((HashtableBucket<mtClass>*)buffer, |
|
2002 sharedDictionaryLen, |
|
2003 number_of_entries); |
|
2004 buffer += sharedDictionaryLen; |
|
2005 |
|
2006 // The following data are the linked list elements |
|
2007 // (HashtableEntry objects) for the shared dictionary table. |
|
2008 |
|
2009 int len = *(intptr_t*)buffer; // skip over shared dictionary entries |
|
2010 buffer += sizeof(intptr_t); |
|
2011 buffer += len; |
|
2012 |
1960 |
2013 // Verify various attributes of the archive, plus initialize the |
1961 // Verify various attributes of the archive, plus initialize the |
2014 // shared string/symbol tables |
1962 // shared string/symbol tables |
2015 intptr_t* array = (intptr_t*)buffer; |
1963 intptr_t* array = (intptr_t*)buffer; |
2016 ReadClosure rc(&array); |
1964 ReadClosure rc(&array); |