comparison src/share/vm/memory/metaspace.cpp @ 20586:03e6d34be1f5

8038268: VM Crashes in MetaspaceShared::generate_vtable_methods while creating CDS archive with limiting SharedMiscCodeSize Summary: estimate the minimum required size for the misc code region and check if the specified misc code region size meets the minimum size requirement Reviewed-by: jiangli, dholmes
author ccheung
date Thu, 30 Oct 2014 13:38:00 -0700
parents 678a467a733b
children 7848fc12602b
comparison
equal deleted inserted replaced
20585:90297adbda9d 20586:03e6d34be1f5
3153 SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment); 3153 SharedReadOnlySize = align_size_up(SharedReadOnlySize, max_alignment);
3154 SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment); 3154 SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3155 SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment); 3155 SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment);
3156 SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment); 3156 SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment);
3157 3157
3158 // the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods()
3159 uintx min_misc_code_size = align_size_up(
3160 (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) *
3161 (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size,
3162 max_alignment);
3163
3164 if (SharedMiscCodeSize < min_misc_code_size) {
3165 report_out_of_shared_space(SharedMiscCode);
3166 }
3167
3158 // Initialize with the sum of the shared space sizes. The read-only 3168 // Initialize with the sum of the shared space sizes. The read-only
3159 // and read write metaspace chunks will be allocated out of this and the 3169 // and read write metaspace chunks will be allocated out of this and the
3160 // remainder is the misc code and data chunks. 3170 // remainder is the misc code and data chunks.
3161 cds_total = FileMapInfo::shared_spaces_size(); 3171 cds_total = FileMapInfo::shared_spaces_size();
3162 cds_total = align_size_up(cds_total, _reserve_alignment); 3172 cds_total = align_size_up(cds_total, _reserve_alignment);