Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/arguments.cpp @ 12056:740e263c80c6
8003424: Enable Class Data Sharing for CompressedOops
8016729: ObjectAlignmentInBytes=16 now forces the use of heap based compressed oops
8005933: The -Xshare:auto option is ignored for -server
Summary: Move klass metaspace above the heap and support CDS with compressed klass ptrs.
Reviewed-by: coleenp, kvn, mgerdin, tschatzl, stefank
author | hseigel |
---|---|
date | Thu, 15 Aug 2013 20:04:10 -0400 |
parents | 5e0b3d7df485 |
children | 58fc8e2b7b6d 4a1efab850f4 a701c16e8bbf e2722a66aba7 |
comparison
equal
deleted
inserted
replaced
12055:d96f52012aaa | 12056:740e263c80c6 |
---|---|
1391 return true; | 1391 return true; |
1392 } | 1392 } |
1393 | 1393 |
1394 inline uintx max_heap_for_compressed_oops() { | 1394 inline uintx max_heap_for_compressed_oops() { |
1395 // Avoid sign flip. | 1395 // Avoid sign flip. |
1396 if (OopEncodingHeapMax < ClassMetaspaceSize + os::vm_page_size()) { | 1396 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); |
1397 return 0; | 1397 LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size()); |
1398 } | |
1399 LP64_ONLY(return OopEncodingHeapMax - ClassMetaspaceSize - os::vm_page_size()); | |
1400 NOT_LP64(ShouldNotReachHere(); return 0); | 1398 NOT_LP64(ShouldNotReachHere(); return 0); |
1401 } | 1399 } |
1402 | 1400 |
1403 bool Arguments::should_auto_select_low_pause_collector() { | 1401 bool Arguments::should_auto_select_low_pause_collector() { |
1404 if (UseAutoGCSelectPolicy && | 1402 if (UseAutoGCSelectPolicy && |
1444 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1442 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); |
1445 } | 1443 } |
1446 } | 1444 } |
1447 #endif // _LP64 | 1445 #endif // _LP64 |
1448 #endif // ZERO | 1446 #endif // ZERO |
1447 } | |
1448 | |
1449 | |
1450 // NOTE: set_use_compressed_klass_ptrs() must be called after calling | |
1451 // set_use_compressed_oops(). | |
1452 void Arguments::set_use_compressed_klass_ptrs() { | |
1453 #ifndef ZERO | |
1454 #ifdef _LP64 | |
1455 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. | |
1456 if (!UseCompressedOops) { | |
1457 if (UseCompressedKlassPointers) { | |
1458 warning("UseCompressedKlassPointers requires UseCompressedOops"); | |
1459 } | |
1460 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | |
1461 } else { | |
1462 // Turn on UseCompressedKlassPointers too | |
1463 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { | |
1464 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); | |
1465 } | |
1466 // Check the ClassMetaspaceSize to make sure we use compressed klass ptrs. | |
1467 if (UseCompressedKlassPointers) { | |
1468 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) { | |
1469 warning("Class metaspace size is too large for UseCompressedKlassPointers"); | |
1470 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | |
1471 } | |
1472 } | |
1473 } | |
1474 #endif // _LP64 | |
1475 #endif // !ZERO | |
1449 } | 1476 } |
1450 | 1477 |
1451 void Arguments::set_ergonomics_flags() { | 1478 void Arguments::set_ergonomics_flags() { |
1452 | 1479 |
1453 if (os::is_server_class_machine()) { | 1480 if (os::is_server_class_machine()) { |
1468 // Shared spaces work fine with other GCs but causes bytecode rewriting | 1495 // Shared spaces work fine with other GCs but causes bytecode rewriting |
1469 // to be disabled, which hurts interpreter performance and decreases | 1496 // to be disabled, which hurts interpreter performance and decreases |
1470 // server performance. On server class machines, keep the default | 1497 // server performance. On server class machines, keep the default |
1471 // off unless it is asked for. Future work: either add bytecode rewriting | 1498 // off unless it is asked for. Future work: either add bytecode rewriting |
1472 // at link time, or rewrite bytecodes in non-shared methods. | 1499 // at link time, or rewrite bytecodes in non-shared methods. |
1473 if (!DumpSharedSpaces && !RequireSharedSpaces) { | 1500 if (!DumpSharedSpaces && !RequireSharedSpaces && |
1501 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { | |
1474 no_shared_spaces(); | 1502 no_shared_spaces(); |
1475 } | 1503 } |
1476 } | 1504 } |
1477 | 1505 |
1478 #ifndef ZERO | 1506 #ifndef ZERO |
1479 #ifdef _LP64 | 1507 #ifdef _LP64 |
1480 set_use_compressed_oops(); | 1508 set_use_compressed_oops(); |
1481 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. | 1509 |
1482 if (!UseCompressedOops) { | 1510 // set_use_compressed_klass_ptrs() must be called after calling |
1483 if (UseCompressedKlassPointers) { | 1511 // set_use_compressed_oops(). |
1484 warning("UseCompressedKlassPointers requires UseCompressedOops"); | 1512 set_use_compressed_klass_ptrs(); |
1485 } | 1513 |
1486 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | |
1487 } else { | |
1488 // Turn on UseCompressedKlassPointers too | |
1489 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { | |
1490 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); | |
1491 } | |
1492 // Set the ClassMetaspaceSize to something that will not need to be | |
1493 // expanded, since it cannot be expanded. | |
1494 if (UseCompressedKlassPointers) { | |
1495 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) { | |
1496 warning("Class metaspace size is too large for UseCompressedKlassPointers"); | |
1497 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | |
1498 } else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) { | |
1499 // 100,000 classes seems like a good size, so 100M assumes around 1K | |
1500 // per klass. The vtable and oopMap is embedded so we don't have a fixed | |
1501 // size per klass. Eventually, this will be parameterized because it | |
1502 // would also be useful to determine the optimal size of the | |
1503 // systemDictionary. | |
1504 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M); | |
1505 } | |
1506 } | |
1507 } | |
1508 // Also checks that certain machines are slower with compressed oops | 1514 // Also checks that certain machines are slower with compressed oops |
1509 // in vm_version initialization code. | 1515 // in vm_version initialization code. |
1510 #endif // _LP64 | 1516 #endif // _LP64 |
1511 #endif // !ZERO | 1517 #endif // !ZERO |
1512 } | 1518 } |
2151 status = status && verify_interval(TLABWasteTargetPercent, | 2157 status = status && verify_interval(TLABWasteTargetPercent, |
2152 1, 100, "TLABWasteTargetPercent"); | 2158 1, 100, "TLABWasteTargetPercent"); |
2153 | 2159 |
2154 status = status && verify_object_alignment(); | 2160 status = status && verify_object_alignment(); |
2155 | 2161 |
2156 status = status && verify_min_value(ClassMetaspaceSize, 1*M, | 2162 status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G, |
2157 "ClassMetaspaceSize"); | 2163 "ClassMetaspaceSize"); |
2158 | 2164 |
2159 status = status && verify_interval(MarkStackSizeMax, | 2165 status = status && verify_interval(MarkStackSizeMax, |
2160 1, (max_jint - 1), "MarkStackSizeMax"); | 2166 1, (max_jint - 1), "MarkStackSizeMax"); |
2161 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); | 2167 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); |
3271 } | 3277 } |
3272 return JNI_OK; | 3278 return JNI_OK; |
3273 } | 3279 } |
3274 | 3280 |
3275 void Arguments::set_shared_spaces_flags() { | 3281 void Arguments::set_shared_spaces_flags() { |
3276 #ifdef _LP64 | |
3277 const bool must_share = DumpSharedSpaces || RequireSharedSpaces; | |
3278 | |
3279 // CompressedOops cannot be used with CDS. The offsets of oopmaps and | |
3280 // static fields are incorrect in the archive. With some more clever | |
3281 // initialization, this restriction can probably be lifted. | |
3282 if (UseCompressedOops) { | |
3283 if (must_share) { | |
3284 warning("disabling compressed oops because of %s", | |
3285 DumpSharedSpaces ? "-Xshare:dump" : "-Xshare:on"); | |
3286 FLAG_SET_CMDLINE(bool, UseCompressedOops, false); | |
3287 FLAG_SET_CMDLINE(bool, UseCompressedKlassPointers, false); | |
3288 } else { | |
3289 // Prefer compressed oops to class data sharing | |
3290 if (UseSharedSpaces && Verbose) { | |
3291 warning("turning off use of shared archive because of compressed oops"); | |
3292 } | |
3293 no_shared_spaces(); | |
3294 } | |
3295 } | |
3296 #endif | |
3297 | |
3298 if (DumpSharedSpaces) { | 3282 if (DumpSharedSpaces) { |
3299 if (RequireSharedSpaces) { | 3283 if (RequireSharedSpaces) { |
3300 warning("cannot dump shared archive while using shared archive"); | 3284 warning("cannot dump shared archive while using shared archive"); |
3301 } | 3285 } |
3302 UseSharedSpaces = false; | 3286 UseSharedSpaces = false; |
3287 #ifdef _LP64 | |
3288 if (!UseCompressedOops || !UseCompressedKlassPointers) { | |
3289 vm_exit_during_initialization( | |
3290 "Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL); | |
3291 } | |
3292 } else { | |
3293 // UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces. | |
3294 if (!UseCompressedOops || !UseCompressedKlassPointers) { | |
3295 no_shared_spaces(); | |
3296 } | |
3297 #endif | |
3303 } | 3298 } |
3304 } | 3299 } |
3305 | 3300 |
3306 #if !INCLUDE_ALL_GCS | 3301 #if !INCLUDE_ALL_GCS |
3307 static void force_serial_gc() { | 3302 static void force_serial_gc() { |