Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp Fri Oct 24 10:28:19 2014 -0700 +++ b/src/share/vm/memory/metaspace.cpp Thu Oct 30 13:38:00 2014 -0700 @@ -3155,6 +3155,16 @@ SharedMiscDataSize = align_size_up(SharedMiscDataSize, max_alignment); SharedMiscCodeSize = align_size_up(SharedMiscCodeSize, max_alignment); + // the min_misc_code_size estimate is based on MetaspaceShared::generate_vtable_methods() + uintx min_misc_code_size = align_size_up( + (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) * + (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size, + max_alignment); + + if (SharedMiscCodeSize < min_misc_code_size) { + report_out_of_shared_space(SharedMiscCode); + } + // Initialize with the sum of the shared space sizes. The read-only // and read write metaspace chunks will be allocated out of this and the // remainder is the misc code and data chunks.