3162 |
3162 |
3163 Universe::set_narrow_klass_shift(0); |
3163 Universe::set_narrow_klass_shift(0); |
3164 #endif // _LP64 |
3164 #endif // _LP64 |
3165 #endif // INCLUDE_CDS |
3165 #endif // INCLUDE_CDS |
3166 } else { |
3166 } else { |
3167 // If using shared space, open the file that contains the shared space |
3167 #if INCLUDE_CDS |
3168 // and map in the memory before initializing the rest of metaspace (so |
|
3169 // the addresses don't conflict) |
|
3170 address cds_address = NULL; |
|
3171 if (UseSharedSpaces) { |
3168 if (UseSharedSpaces) { |
3172 #if INCLUDE_CDS |
3169 // If using shared space, open the file that contains the shared space |
|
3170 // and map in the memory before initializing the rest of metaspace (so |
|
3171 // the addresses don't conflict) |
|
3172 address cds_address = NULL; |
3173 FileMapInfo* mapinfo = new FileMapInfo(); |
3173 FileMapInfo* mapinfo = new FileMapInfo(); |
3174 |
3174 |
3175 // Open the shared archive file, read and validate the header. If |
3175 if (JvmtiExport::should_post_class_file_load_hook()) { |
3176 // initialization fails, shared spaces [UseSharedSpaces] are |
3176 // Currently CDS does not support JVMTI CFLH when loading shared class. |
3177 // disabled and the file is closed. |
3177 // If JvmtiExport::should_post_class_file_load_hook is already enabled, |
3178 // Map in spaces now also |
3178 // just disable UseSharedSpaces. |
3179 if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) { |
3179 FileMapInfo::fail_continue("Tool agent requires sharing to be disabled."); |
3180 cds_total = FileMapInfo::shared_spaces_size(); |
3180 delete mapinfo; |
3181 cds_address = (address)mapinfo->header()->region_addr(0); |
3181 } else { |
|
3182 // Open the shared archive file, read and validate the header. If |
|
3183 // initialization fails, shared spaces [UseSharedSpaces] are |
|
3184 // disabled and the file is closed. |
|
3185 // Map in spaces now also |
|
3186 if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) { |
|
3187 cds_total = FileMapInfo::shared_spaces_size(); |
|
3188 cds_address = (address)mapinfo->header()->region_addr(0); |
3182 #ifdef _LP64 |
3189 #ifdef _LP64 |
3183 if (using_class_space()) { |
3190 if (using_class_space()) { |
3184 char* cds_end = (char*)(cds_address + cds_total); |
3191 char* cds_end = (char*)(cds_address + cds_total); |
3185 cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); |
3192 cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment); |
3186 // If UseCompressedClassPointers is set then allocate the metaspace area |
3193 // If UseCompressedClassPointers is set then allocate the metaspace area |
3187 // above the heap and above the CDS area (if it exists). |
3194 // above the heap and above the CDS area (if it exists). |
3188 allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); |
3195 allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address); |
3189 // Map the shared string space after compressed pointers |
3196 // Map the shared string space after compressed pointers |
3190 // because it relies on compressed class pointers setting to work |
3197 // because it relies on compressed class pointers setting to work |
3191 mapinfo->map_string_regions(); |
3198 mapinfo->map_string_regions(); |
|
3199 } |
|
3200 #endif // _LP64 |
|
3201 } else { |
|
3202 assert(!mapinfo->is_open() && !UseSharedSpaces, |
|
3203 "archive file not closed or shared spaces not disabled."); |
3192 } |
3204 } |
3193 #endif // _LP64 |
|
3194 } else { |
|
3195 assert(!mapinfo->is_open() && !UseSharedSpaces, |
|
3196 "archive file not closed or shared spaces not disabled."); |
|
3197 } |
3205 } |
|
3206 } |
3198 #endif // INCLUDE_CDS |
3207 #endif // INCLUDE_CDS |
3199 } |
|
3200 |
3208 |
3201 #ifdef _LP64 |
3209 #ifdef _LP64 |
3202 if (!UseSharedSpaces && using_class_space()) { |
3210 if (!UseSharedSpaces && using_class_space()) { |
3203 char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment); |
3211 char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment); |
3204 allocate_metaspace_compressed_klass_ptrs(base, 0); |
3212 allocate_metaspace_compressed_klass_ptrs(base, 0); |