src/share/vm/runtime/arguments.cpp

changeset 6462
e2722a66aba7
parent 6461
bdd155477289
parent 5528
740e263c80c6
child 6470
abe03600372a
     1.1 --- a/src/share/vm/runtime/arguments.cpp	Thu Aug 22 09:39:54 2013 -0700
     1.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Sep 05 11:04:39 2013 -0700
     1.3 @@ -1396,10 +1396,8 @@
     1.4  
     1.5  inline uintx max_heap_for_compressed_oops() {
     1.6    // Avoid sign flip.
     1.7 -  if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) {
     1.8 -    return 0;
     1.9 -  }
    1.10 -  LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size());
    1.11 +  assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
    1.12 +  LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size());
    1.13    NOT_LP64(ShouldNotReachHere(); return 0);
    1.14  }
    1.15  
    1.16 @@ -1451,6 +1449,35 @@
    1.17  #endif // ZERO
    1.18  }
    1.19  
    1.20 +
    1.21 +// NOTE: set_use_compressed_klass_ptrs() must be called after calling
    1.22 +// set_use_compressed_oops().
    1.23 +void Arguments::set_use_compressed_klass_ptrs() {
    1.24 +#ifndef ZERO
    1.25 +#ifdef _LP64
    1.26 +  // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
    1.27 +  if (!UseCompressedOops) {
    1.28 +    if (UseCompressedKlassPointers) {
    1.29 +      warning("UseCompressedKlassPointers requires UseCompressedOops");
    1.30 +    }
    1.31 +    FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
    1.32 +  } else {
    1.33 +    // Turn on UseCompressedKlassPointers too
    1.34 +    if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
    1.35 +      FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
    1.36 +    }
    1.37 +    // Check the ClassMetaspaceSize to make sure we use compressed klass ptrs.
    1.38 +    if (UseCompressedKlassPointers) {
    1.39 +      if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
    1.40 +        warning("Class metaspace size is too large for UseCompressedKlassPointers");
    1.41 +        FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
    1.42 +      }
    1.43 +    }
    1.44 +  }
    1.45 +#endif // _LP64
    1.46 +#endif // !ZERO
    1.47 +}
    1.48 +
    1.49  void Arguments::set_ergonomics_flags() {
    1.50  
    1.51    if (os::is_server_class_machine()) {
    1.52 @@ -1473,7 +1500,8 @@
    1.53      // server performance.   On server class machines, keep the default
    1.54      // off unless it is asked for.  Future work: either add bytecode rewriting
    1.55      // at link time, or rewrite bytecodes in non-shared methods.
    1.56 -    if (!DumpSharedSpaces && !RequireSharedSpaces) {
    1.57 +    if (!DumpSharedSpaces && !RequireSharedSpaces &&
    1.58 +        (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
    1.59        no_shared_spaces();
    1.60      }
    1.61    }
    1.62 @@ -1481,33 +1509,11 @@
    1.63  #ifndef ZERO
    1.64  #ifdef _LP64
    1.65    set_use_compressed_oops();
    1.66 -  // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
    1.67 -  if (!UseCompressedOops) {
    1.68 -    if (UseCompressedKlassPointers) {
    1.69 -      warning("UseCompressedKlassPointers requires UseCompressedOops");
    1.70 -    }
    1.71 -    FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
    1.72 -  } else {
    1.73 -    // Turn on UseCompressedKlassPointers too
    1.74 -    if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
    1.75 -      FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
    1.76 -    }
    1.77 -    // Set the ClassMetaspaceSize to something that will not need to be
    1.78 -    // expanded, since it cannot be expanded.
    1.79 -    if (UseCompressedKlassPointers) {
    1.80 -      if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
    1.81 -        warning("Class metaspace size is too large for UseCompressedKlassPointers");
    1.82 -        FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
    1.83 -      } else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
    1.84 -        // 100,000 classes seems like a good size, so 100M assumes around 1K
    1.85 -        // per klass.   The vtable and oopMap is embedded so we don't have a fixed
    1.86 -        // size per klass.   Eventually, this will be parameterized because it
    1.87 -        // would also be useful to determine the optimal size of the
    1.88 -        // systemDictionary.
    1.89 -        FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
    1.90 -      }
    1.91 -    }
    1.92 -  }
    1.93 +
    1.94 +  // set_use_compressed_klass_ptrs() must be called after calling
    1.95 +  // set_use_compressed_oops().
    1.96 +  set_use_compressed_klass_ptrs();
    1.97 +
    1.98    // Also checks that certain machines are slower with compressed oops
    1.99    // in vm_version initialization code.
   1.100  #endif // _LP64
   1.101 @@ -2156,7 +2162,7 @@
   1.102  
   1.103    status = status && verify_object_alignment();
   1.104  
   1.105 -  status = status && verify_min_value(ClassMetaspaceSize, 1*M,
   1.106 +  status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G,
   1.107                                        "ClassMetaspaceSize");
   1.108  
   1.109    status = status && verify_interval(MarkStackSizeMax,
   1.110 @@ -3276,33 +3282,22 @@
   1.111  }
   1.112  
   1.113  void Arguments::set_shared_spaces_flags() {
   1.114 -#ifdef _LP64
   1.115 -    const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
   1.116 -
   1.117 -    // CompressedOops cannot be used with CDS.  The offsets of oopmaps and
   1.118 -    // static fields are incorrect in the archive.  With some more clever
   1.119 -    // initialization, this restriction can probably be lifted.
   1.120 -    if (UseCompressedOops) {
   1.121 -      if (must_share) {
   1.122 -          warning("disabling compressed oops because of %s",
   1.123 -                  DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
   1.124 -          FLAG_SET_CMDLINE(bool, UseCompressedOops, false);
   1.125 -          FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false);
   1.126 -      } else {
   1.127 -        // Prefer compressed oops to class data sharing
   1.128 -        if (UseSharedSpaces && Verbose) {
   1.129 -          warning("turning off use of shared archive because of compressed oops");
   1.130 -        }
   1.131 -        no_shared_spaces();
   1.132 -      }
   1.133 -    }
   1.134 -#endif
   1.135 -
   1.136    if (DumpSharedSpaces) {
   1.137      if (RequireSharedSpaces) {
   1.138        warning("cannot dump shared archive while using shared archive");
   1.139      }
   1.140      UseSharedSpaces = false;
   1.141 +#ifdef _LP64
   1.142 +    if (!UseCompressedOops || !UseCompressedKlassPointers) {
   1.143 +      vm_exit_during_initialization(
   1.144 +        "Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL);
   1.145 +    }
   1.146 +  } else {
   1.147 +    // UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces.
   1.148 +    if (!UseCompressedOops || !UseCompressedKlassPointers) {
   1.149 +      no_shared_spaces();
   1.150 +    }
   1.151 +#endif
   1.152    }
   1.153  }
   1.154  

mercurial