src/hotspot/share/memory/metaspaceShared.cpp
changeset 54780 f8d182aedc92
parent 54371 72e44c1e7dc6
child 54786 ebf733a324d4
equal deleted inserted replaced
54779:e0bd4c7a176e 54780:f8d182aedc92
   244       Metaspace::allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
   244       Metaspace::allocate_metaspace_compressed_klass_ptrs(cds_end, cds_address);
   245       // map_heap_regions() compares the current narrow oop and klass encodings
   245       // map_heap_regions() compares the current narrow oop and klass encodings
   246       // with the archived ones, so it must be done after all encodings are determined.
   246       // with the archived ones, so it must be done after all encodings are determined.
   247       mapinfo->map_heap_regions();
   247       mapinfo->map_heap_regions();
   248     }
   248     }
   249     Universe::set_narrow_klass_range(CompressedClassSpaceSize);
   249     CompressedKlassPointers::set_range(CompressedClassSpaceSize);
   250 #endif // _LP64
   250 #endif // _LP64
   251   } else {
   251   } else {
   252     assert(!mapinfo->is_open() && !UseSharedSpaces,
   252     assert(!mapinfo->is_open() && !UseSharedSpaces,
   253            "archive file not closed or shared spaces not disabled.");
   253            "archive file not closed or shared spaces not disabled.");
   254   }
   254   }
   306   ReservedSpace tmp_class_space = _shared_rs.last_part(max_archive_size);
   306   ReservedSpace tmp_class_space = _shared_rs.last_part(max_archive_size);
   307   CompressedClassSpaceSize = align_down(tmp_class_space.size(), reserve_alignment);
   307   CompressedClassSpaceSize = align_down(tmp_class_space.size(), reserve_alignment);
   308   _shared_rs = _shared_rs.first_part(max_archive_size);
   308   _shared_rs = _shared_rs.first_part(max_archive_size);
   309 
   309 
   310   // Set up compress class pointers.
   310   // Set up compress class pointers.
   311   Universe::set_narrow_klass_base((address)_shared_rs.base());
   311   CompressedKlassPointers::set_base((address)_shared_rs.base());
   312   // Set narrow_klass_shift to be LogKlassAlignmentInBytes. This is consistent
   312   // Set narrow_klass_shift to be LogKlassAlignmentInBytes. This is consistent
   313   // with AOT.
   313   // with AOT.
   314   Universe::set_narrow_klass_shift(LogKlassAlignmentInBytes);
   314   CompressedKlassPointers::set_shift(LogKlassAlignmentInBytes);
   315   // Set the range of klass addresses to 4GB.
   315   // Set the range of klass addresses to 4GB.
   316   Universe::set_narrow_klass_range(cds_total);
   316   CompressedKlassPointers::set_range(cds_total);
   317 
   317 
   318   Metaspace::initialize_class_space(tmp_class_space);
   318   Metaspace::initialize_class_space(tmp_class_space);
   319   log_info(cds)("narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
   319   log_info(cds)("narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",
   320                 p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
   320                 p2i(CompressedKlassPointers::base()), CompressedKlassPointers::shift());
   321 
   321 
   322   log_info(cds)("Allocated temporary class space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
   322   log_info(cds)("Allocated temporary class space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
   323                 CompressedClassSpaceSize, p2i(tmp_class_space.base()));
   323                 CompressedClassSpaceSize, p2i(tmp_class_space.base()));
   324 #endif
   324 #endif
   325 
   325