492 size_t estimate_archive_size(); |
492 size_t estimate_archive_size(); |
493 size_t estimate_trampoline_size(); |
493 size_t estimate_trampoline_size(); |
494 size_t estimate_class_file_size(); |
494 size_t estimate_class_file_size(); |
495 address reserve_space_and_init_buffer_to_target_delta(); |
495 address reserve_space_and_init_buffer_to_target_delta(); |
496 void init_header(address addr); |
496 void init_header(address addr); |
|
497 void release_header(); |
497 void make_trampolines(); |
498 void make_trampolines(); |
498 void make_klasses_shareable(); |
499 void make_klasses_shareable(); |
499 void sort_methods(InstanceKlass* ik) const; |
500 void sort_methods(InstanceKlass* ik) const; |
500 void set_symbols_permanent(); |
501 void set_symbols_permanent(); |
501 void relocate_buffer_to_target(); |
502 void relocate_buffer_to_target(); |
662 iterate_roots(&marker); |
663 iterate_roots(&marker); |
663 relocate_buffer_to_target(); |
664 relocate_buffer_to_target(); |
664 } |
665 } |
665 |
666 |
666 write_archive(serialized_data_start); |
667 write_archive(serialized_data_start); |
|
668 release_header(); |
667 |
669 |
668 assert(_num_dump_regions_used == _total_dump_regions, "must be"); |
670 assert(_num_dump_regions_used == _total_dump_regions, "must be"); |
669 verify_universe("After CDS dynamic dump"); |
671 verify_universe("After CDS dynamic dump"); |
670 } |
672 } |
671 |
673 |
753 _other_region_used_bytes = 0; |
755 _other_region_used_bytes = 0; |
754 |
756 |
755 init_first_dump_space(reserved_bottom); |
757 init_first_dump_space(reserved_bottom); |
756 |
758 |
757 FileMapInfo* mapinfo = new FileMapInfo(false); |
759 FileMapInfo* mapinfo = new FileMapInfo(false); |
|
760 assert(FileMapInfo::dynamic_info() == mapinfo, "must be"); |
758 _header = mapinfo->dynamic_header(); |
761 _header = mapinfo->dynamic_header(); |
759 |
762 |
760 Thread* THREAD = Thread::current(); |
763 Thread* THREAD = Thread::current(); |
761 FileMapInfo* base_info = FileMapInfo::current_info(); |
764 FileMapInfo* base_info = FileMapInfo::current_info(); |
762 _header->set_base_header_crc(base_info->crc()); |
765 _header->set_base_header_crc(base_info->crc()); |
763 for (int i = 0; i < MetaspaceShared::n_regions; i++) { |
766 for (int i = 0; i < MetaspaceShared::n_regions; i++) { |
764 _header->set_base_region_crc(i, base_info->space_crc(i)); |
767 _header->set_base_region_crc(i, base_info->space_crc(i)); |
765 } |
768 } |
766 _header->populate(base_info, os::vm_allocation_granularity()); |
769 _header->populate(base_info, os::vm_allocation_granularity()); |
|
770 } |
|
771 |
|
772 void DynamicArchiveBuilder::release_header() { |
|
773 // We temporarily allocated a dynamic FileMapInfo for dumping, which makes it appear we |
|
774 // have mapped a dynamic archive, but we actually have not. We are in a safepoint now. |
|
775 // Let's free it so that if class loading happens after we leave the safepoint, nothing |
|
776 // bad will happen. |
|
777 assert(SafepointSynchronize::is_at_safepoint(), "must be"); |
|
778 FileMapInfo *mapinfo = FileMapInfo::dynamic_info(); |
|
779 assert(mapinfo != NULL && _header == mapinfo->dynamic_header(), "must be"); |
|
780 delete mapinfo; |
|
781 assert(!DynamicArchive::is_mapped(), "must be"); |
|
782 _header = NULL; |
767 } |
783 } |
768 |
784 |
769 size_t DynamicArchiveBuilder::estimate_trampoline_size() { |
785 size_t DynamicArchiveBuilder::estimate_trampoline_size() { |
770 size_t total = 0; |
786 size_t total = 0; |
771 size_t each_method_bytes = |
787 size_t each_method_bytes = |