< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page




3242     }
3243 
3244     Universe::set_narrow_klass_shift(0);
3245 #endif // _LP64
3246 #endif // INCLUDE_CDS
3247   } else {
3248 #if INCLUDE_CDS
3249     // If using shared space, open the file that contains the shared space
3250     // and map in the memory before initializing the rest of metaspace (so
3251     // the addresses don't conflict)
3252     address cds_address = NULL;
3253     if (UseSharedSpaces) {
3254       FileMapInfo* mapinfo = new FileMapInfo();
3255 
3256       // Open the shared archive file, read and validate the header. If
3257       // initialization fails, shared spaces [UseSharedSpaces] are
3258       // disabled and the file is closed.
3259       // Map in spaces now also
3260       if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
3261         cds_total = FileMapInfo::shared_spaces_size();
3262         cds_address = (address)mapinfo->region_base(0);
3263       } else {
3264         assert(!mapinfo->is_open() && !UseSharedSpaces,
3265                "archive file not closed or shared spaces not disabled.");
3266       }
3267     }
3268 #endif // INCLUDE_CDS
3269 #ifdef _LP64
3270     // If UseCompressedClassPointers is set then allocate the metaspace area
3271     // above the heap and above the CDS area (if it exists).
3272     if (using_class_space()) {
3273       if (UseSharedSpaces) {
3274 #if INCLUDE_CDS
3275         char* cds_end = (char*)(cds_address + cds_total);
3276         cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
3277         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
3278 #endif
3279       } else {
3280         char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
3281         allocate_metaspace_compressed_klass_ptrs(base, 0);
3282       }




3242     }
3243 
3244     Universe::set_narrow_klass_shift(0);
3245 #endif // _LP64
3246 #endif // INCLUDE_CDS
3247   } else {
3248 #if INCLUDE_CDS
3249     // If using shared space, open the file that contains the shared space
3250     // and map in the memory before initializing the rest of metaspace (so
3251     // the addresses don't conflict)
3252     address cds_address = NULL;
3253     if (UseSharedSpaces) {
3254       FileMapInfo* mapinfo = new FileMapInfo();
3255 
3256       // Open the shared archive file, read and validate the header. If
3257       // initialization fails, shared spaces [UseSharedSpaces] are
3258       // disabled and the file is closed.
3259       // Map in spaces now also
3260       if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
3261         cds_total = FileMapInfo::shared_spaces_size();
3262         cds_address = (address)mapinfo->header()->region_addr(0);
3263       } else {
3264         assert(!mapinfo->is_open() && !UseSharedSpaces,
3265                "archive file not closed or shared spaces not disabled.");
3266       }
3267     }
3268 #endif // INCLUDE_CDS
3269 #ifdef _LP64
3270     // If UseCompressedClassPointers is set then allocate the metaspace area
3271     // above the heap and above the CDS area (if it exists).
3272     if (using_class_space()) {
3273       if (UseSharedSpaces) {
3274 #if INCLUDE_CDS
3275         char* cds_end = (char*)(cds_address + cds_total);
3276         cds_end = (char *)align_ptr_up(cds_end, _reserve_alignment);
3277         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
3278 #endif
3279       } else {
3280         char* base = (char*)align_ptr_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
3281         allocate_metaspace_compressed_klass_ptrs(base, 0);
3282       }


< prev index next >