< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page




3330     // If using shared space, open the file that contains the shared space
3331     // and map in the memory before initializing the rest of metaspace (so
3332     // the addresses don't conflict)
3333     address cds_address = NULL;
3334     FileMapInfo* mapinfo = new FileMapInfo();
3335 
3336     // Open the shared archive file, read and validate the header. If
3337     // initialization fails, shared spaces [UseSharedSpaces] are
3338     // disabled and the file is closed.
3339     // Map in spaces now also
3340     if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
3341       size_t cds_total = MetaspaceShared::core_spaces_size();
3342       cds_address = (address)mapinfo->header()->region_addr(0);
3343 #ifdef _LP64
3344       if (using_class_space()) {
3345         char* cds_end = (char*)(cds_address + cds_total);
3346         cds_end = (char *)align_up(cds_end, _reserve_alignment);
3347         // If UseCompressedClassPointers is set then allocate the metaspace area
3348         // above the heap and above the CDS area (if it exists).
3349         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
3350         // Map the shared string space after compressed pointers
3351         // because it relies on compressed class pointers setting to work
3352         mapinfo->map_string_regions();
3353       }
3354 #endif // _LP64
3355     } else {
3356       assert(!mapinfo->is_open() && !UseSharedSpaces,
3357              "archive file not closed or shared spaces not disabled.");
3358     }
3359   }
3360 #endif // INCLUDE_CDS
3361 
3362 #ifdef _LP64
3363   if (!UseSharedSpaces && using_class_space()) {
3364     if (DumpSharedSpaces) {
3365       // Already initialized inside MetaspaceShared::initialize_shared_rs()
3366     } else {
3367       char* base = (char*)align_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
3368       allocate_metaspace_compressed_klass_ptrs(base, 0);
3369     }
3370   }
3371 #endif // _LP64
3372 




3330     // If using shared space, open the file that contains the shared space
3331     // and map in the memory before initializing the rest of metaspace (so
3332     // the addresses don't conflict)
3333     address cds_address = NULL;
3334     FileMapInfo* mapinfo = new FileMapInfo();
3335 
3336     // Open the shared archive file, read and validate the header. If
3337     // initialization fails, shared spaces [UseSharedSpaces] are
3338     // disabled and the file is closed.
3339     // Map in spaces now also
3340     if (mapinfo->initialize() && MetaspaceShared::map_shared_spaces(mapinfo)) {
3341       size_t cds_total = MetaspaceShared::core_spaces_size();
3342       cds_address = (address)mapinfo->header()->region_addr(0);
3343 #ifdef _LP64
3344       if (using_class_space()) {
3345         char* cds_end = (char*)(cds_address + cds_total);
3346         cds_end = (char *)align_up(cds_end, _reserve_alignment);
3347         // If UseCompressedClassPointers is set then allocate the metaspace area
3348         // above the heap and above the CDS area (if it exists).
3349         allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
3350         // Map the archived heap regions after compressed pointers
3351         // because it relies on compressed class pointers setting to work
3352         mapinfo->map_heap_regions();
3353       }
3354 #endif // _LP64
3355     } else {
3356       assert(!mapinfo->is_open() && !UseSharedSpaces,
3357              "archive file not closed or shared spaces not disabled.");
3358     }
3359   }
3360 #endif // INCLUDE_CDS
3361 
3362 #ifdef _LP64
3363   if (!UseSharedSpaces && using_class_space()) {
3364     if (DumpSharedSpaces) {
3365       // Already initialized inside MetaspaceShared::initialize_shared_rs()
3366     } else {
3367       char* base = (char*)align_up(Universe::heap()->reserved_region().end(), _reserve_alignment);
3368       allocate_metaspace_compressed_klass_ptrs(base, 0);
3369     }
3370   }
3371 #endif // _LP64
3372 


< prev index next >