src/hotspot/share/memory/metaspaceShared.cpp
changeset 49481 8d02d496e785
parent 49480 d7df2dd501ce
child 49592 77fb0be7d19f
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Wed Mar 21 19:45:24 2018 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Mar 20 22:54:02 2018 +0800
@@ -234,6 +234,7 @@
       // with the archived ones, so it must be done after all encodings are determined.
       mapinfo->map_heap_regions();
     }
+    Universe::set_narrow_klass_range(CompressedClassSpaceSize);
 #endif // _LP64
   } else {
     assert(!mapinfo->is_open() && !UseSharedSpaces,
@@ -299,6 +300,8 @@
   // Set narrow_klass_shift to be LogKlassAlignmentInBytes. This is consistent
   // with AOT.
   Universe::set_narrow_klass_shift(LogKlassAlignmentInBytes);
+  // Set the range of klass addresses to 4GB.
+  Universe::set_narrow_klass_range(cds_total);
 
   Metaspace::initialize_class_space(tmp_class_space);
   tty->print_cr("narrow_klass_base = " PTR_FORMAT ", narrow_klass_shift = %d",