comparison src/share/vm/runtime/arguments.cpp @ 12057:58fc8e2b7b6d

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Thu, 10 Oct 2013 17:22:25 +0200
parents 3cce976666d9 740e263c80c6
children cefad50507d8
comparison
equal deleted inserted replaced
12041:7e5cf369559f 12057:58fc8e2b7b6d
1400 return true; 1400 return true;
1401 } 1401 }
1402 1402
1403 inline uintx max_heap_for_compressed_oops() { 1403 inline uintx max_heap_for_compressed_oops() {
1404 // Avoid sign flip. 1404 // Avoid sign flip.
1405 if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) { 1405 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size");
1406 return 0; 1406 LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size());
1407 }
1408 LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size());
1409 NOT_LP64(ShouldNotReachHere(); return 0); 1407 NOT_LP64(ShouldNotReachHere(); return 0);
1410 } 1408 }
1411 1409
1412 bool Arguments::should_auto_select_low_pause_collector() { 1410 bool Arguments::should_auto_select_low_pause_collector() {
1413 if (UseAutoGCSelectPolicy && 1411 if (UseAutoGCSelectPolicy &&
1453 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); 1451 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1454 } 1452 }
1455 } 1453 }
1456 #endif // _LP64 1454 #endif // _LP64
1457 #endif // ZERO 1455 #endif // ZERO
1456 }
1457
1458
1459 // NOTE: set_use_compressed_klass_ptrs() must be called after calling
1460 // set_use_compressed_oops().
1461 void Arguments::set_use_compressed_klass_ptrs() {
1462 #ifndef ZERO
1463 #ifdef _LP64
1464 // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
1465 if (!UseCompressedOops) {
1466 if (UseCompressedKlassPointers) {
1467 warning("UseCompressedKlassPointers requires UseCompressedOops");
1468 }
1469 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1470 } else {
1471 // Turn on UseCompressedKlassPointers too
1472 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
1473 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
1474 }
1475 // Check the ClassMetaspaceSize to make sure we use compressed klass ptrs.
1476 if (UseCompressedKlassPointers) {
1477 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
1478 warning("Class metaspace size is too large for UseCompressedKlassPointers");
1479 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1480 }
1481 }
1482 }
1483 #endif // _LP64
1484 #endif // !ZERO
1458 } 1485 }
1459 1486
1460 void Arguments::set_ergonomics_flags() { 1487 void Arguments::set_ergonomics_flags() {
1461 1488
1462 if (os::is_server_class_machine()) { 1489 if (os::is_server_class_machine()) {
1477 // Shared spaces work fine with other GCs but causes bytecode rewriting 1504 // Shared spaces work fine with other GCs but causes bytecode rewriting
1478 // to be disabled, which hurts interpreter performance and decreases 1505 // to be disabled, which hurts interpreter performance and decreases
1479 // server performance. On server class machines, keep the default 1506 // server performance. On server class machines, keep the default
1480 // off unless it is asked for. Future work: either add bytecode rewriting 1507 // off unless it is asked for. Future work: either add bytecode rewriting
1481 // at link time, or rewrite bytecodes in non-shared methods. 1508 // at link time, or rewrite bytecodes in non-shared methods.
1482 if (!DumpSharedSpaces && !RequireSharedSpaces) { 1509 if (!DumpSharedSpaces && !RequireSharedSpaces &&
1510 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1483 no_shared_spaces(); 1511 no_shared_spaces();
1484 } 1512 }
1485 } 1513 }
1486 1514
1487 #ifndef ZERO 1515 #ifndef ZERO
1488 #ifdef _LP64 1516 #ifdef _LP64
1489 set_use_compressed_oops(); 1517 set_use_compressed_oops();
1490 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. 1518
1491 if (!UseCompressedOops) { 1519 // set_use_compressed_klass_ptrs() must be called after calling
1492 if (UseCompressedKlassPointers) { 1520 // set_use_compressed_oops().
1493 warning("UseCompressedKlassPointers requires UseCompressedOops"); 1521 set_use_compressed_klass_ptrs();
1494 } 1522
1495 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1496 } else {
1497 // Turn on UseCompressedKlassPointers too
1498 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
1499 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
1500 }
1501 // Set the ClassMetaspaceSize to something that will not need to be
1502 // expanded, since it cannot be expanded.
1503 if (UseCompressedKlassPointers) {
1504 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
1505 warning("Class metaspace size is too large for UseCompressedKlassPointers");
1506 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1507 } else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
1508 // 100,000 classes seems like a good size, so 100M assumes around 1K
1509 // per klass. The vtable and oopMap is embedded so we don't have a fixed
1510 // size per klass. Eventually, this will be parameterized because it
1511 // would also be useful to determine the optimal size of the
1512 // systemDictionary.
1513 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
1514 }
1515 }
1516 }
1517 // Also checks that certain machines are slower with compressed oops 1523 // Also checks that certain machines are slower with compressed oops
1518 // in vm_version initialization code. 1524 // in vm_version initialization code.
1519 #endif // _LP64 1525 #endif // _LP64
1520 #endif // !ZERO 1526 #endif // !ZERO
1521 } 1527 }
2160 status = status && verify_interval(TLABWasteTargetPercent, 2166 status = status && verify_interval(TLABWasteTargetPercent,
2161 1, 100, "TLABWasteTargetPercent"); 2167 1, 100, "TLABWasteTargetPercent");
2162 2168
2163 status = status && verify_object_alignment(); 2169 status = status && verify_object_alignment();
2164 2170
2165 status = status && verify_min_value(ClassMetaspaceSize, 1*M, 2171 status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G,
2166 "ClassMetaspaceSize"); 2172 "ClassMetaspaceSize");
2167 2173
2168 status = status && verify_interval(MarkStackSizeMax, 2174 status = status && verify_interval(MarkStackSizeMax,
2169 1, (max_jint - 1), "MarkStackSizeMax"); 2175 1, (max_jint - 1), "MarkStackSizeMax");
2170 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); 2176 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight");
3309 } 3315 }
3310 return JNI_OK; 3316 return JNI_OK;
3311 } 3317 }
3312 3318
3313 void Arguments::set_shared_spaces_flags() { 3319 void Arguments::set_shared_spaces_flags() {
3314 #ifdef _LP64
3315 const bool must_share = DumpSharedSpaces || RequireSharedSpaces;
3316
3317 // CompressedOops cannot be used with CDS. The offsets of oopmaps and
3318 // static fields are incorrect in the archive. With some more clever
3319 // initialization, this restriction can probably be lifted.
3320 if (UseCompressedOops) {
3321 if (must_share) {
3322 warning("disabling compressed oops because of %s",
3323 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on");
3324 FLAG_SET_CMDLINE(bool, UseCompressedOops, false);
3325 FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false);
3326 } else {
3327 // Prefer compressed oops to class data sharing
3328 if (UseSharedSpaces && Verbose) {
3329 warning("turning off use of shared archive because of compressed oops");
3330 }
3331 no_shared_spaces();
3332 }
3333 }
3334 #endif
3335
3336 if (DumpSharedSpaces) { 3320 if (DumpSharedSpaces) {
3337 if (RequireSharedSpaces) { 3321 if (RequireSharedSpaces) {
3338 warning("cannot dump shared archive while using shared archive"); 3322 warning("cannot dump shared archive while using shared archive");
3339 } 3323 }
3340 UseSharedSpaces = false; 3324 UseSharedSpaces = false;
3325 #ifdef _LP64
3326 if (!UseCompressedOops || !UseCompressedKlassPointers) {
3327 vm_exit_during_initialization(
3328 "Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL);
3329 }
3330 } else {
3331 // UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces.
3332 if (!UseCompressedOops || !UseCompressedKlassPointers) {
3333 no_shared_spaces();
3334 }
3335 #endif
3341 } 3336 }
3342 } 3337 }
3343 3338
3344 #if !INCLUDE_ALL_GCS 3339 #if !INCLUDE_ALL_GCS
3345 static void force_serial_gc() { 3340 static void force_serial_gc() {