Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 12252:06ae47d9d088
Merge
author | tschatzl |
---|---|
date | Thu, 19 Sep 2013 09:26:08 +0200 |
parents | 621eda7235d2 40136aa2cdb1 |
children | da051ce490eb |
comparison
equal
deleted
inserted
replaced
12219:41e6ae9f6dd7 | 12252:06ae47d9d088 |
---|---|
26 #include "classfile/javaAssertions.hpp" | 26 #include "classfile/javaAssertions.hpp" |
27 #include "classfile/symbolTable.hpp" | 27 #include "classfile/symbolTable.hpp" |
28 #include "compiler/compilerOracle.hpp" | 28 #include "compiler/compilerOracle.hpp" |
29 #include "memory/allocation.inline.hpp" | 29 #include "memory/allocation.inline.hpp" |
30 #include "memory/cardTableRS.hpp" | 30 #include "memory/cardTableRS.hpp" |
31 #include "memory/genCollectedHeap.hpp" | |
31 #include "memory/referenceProcessor.hpp" | 32 #include "memory/referenceProcessor.hpp" |
32 #include "memory/universe.inline.hpp" | 33 #include "memory/universe.inline.hpp" |
33 #include "oops/oop.inline.hpp" | 34 #include "oops/oop.inline.hpp" |
34 #include "prims/jvmtiExport.hpp" | 35 #include "prims/jvmtiExport.hpp" |
35 #include "runtime/arguments.hpp" | 36 #include "runtime/arguments.hpp" |
52 #ifdef TARGET_OS_FAMILY_bsd | 53 #ifdef TARGET_OS_FAMILY_bsd |
53 # include "os_bsd.inline.hpp" | 54 # include "os_bsd.inline.hpp" |
54 #endif | 55 #endif |
55 #if INCLUDE_ALL_GCS | 56 #if INCLUDE_ALL_GCS |
56 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" | 57 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp" |
58 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
59 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" | |
57 #endif // INCLUDE_ALL_GCS | 60 #endif // INCLUDE_ALL_GCS |
58 | 61 |
59 // Note: This is a special bug reporting site for the JVM | 62 // Note: This is a special bug reporting site for the JVM |
60 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" | 63 #define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp" |
61 #define DEFAULT_JAVA_LAUNCHER "generic" | 64 #define DEFAULT_JAVA_LAUNCHER "generic" |
88 int Arguments::_num_jvm_args = 0; | 91 int Arguments::_num_jvm_args = 0; |
89 char* Arguments::_java_command = NULL; | 92 char* Arguments::_java_command = NULL; |
90 SystemProperty* Arguments::_system_properties = NULL; | 93 SystemProperty* Arguments::_system_properties = NULL; |
91 const char* Arguments::_gc_log_filename = NULL; | 94 const char* Arguments::_gc_log_filename = NULL; |
92 bool Arguments::_has_profile = false; | 95 bool Arguments::_has_profile = false; |
96 size_t Arguments::_conservative_max_heap_alignment = 0; | |
93 uintx Arguments::_min_heap_size = 0; | 97 uintx Arguments::_min_heap_size = 0; |
94 Arguments::Mode Arguments::_mode = _mixed; | 98 Arguments::Mode Arguments::_mode = _mixed; |
95 bool Arguments::_java_compiler = false; | 99 bool Arguments::_java_compiler = false; |
96 bool Arguments::_xdebug_mode = false; | 100 bool Arguments::_xdebug_mode = false; |
97 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; | 101 const char* Arguments::_java_vendor_url_bug = DEFAULT_VENDOR_URL_BUG; |
1389 return false; | 1393 return false; |
1390 } | 1394 } |
1391 return true; | 1395 return true; |
1392 } | 1396 } |
1393 | 1397 |
1394 inline uintx max_heap_for_compressed_oops() { | 1398 uintx Arguments::max_heap_for_compressed_oops() { |
1395 // Avoid sign flip. | 1399 // Avoid sign flip. |
1396 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); | 1400 assert(OopEncodingHeapMax > (uint64_t)os::vm_page_size(), "Unusual page size"); |
1397 LP64_ONLY(return OopEncodingHeapMax - os::vm_page_size()); | 1401 // We need to fit both the NULL page and the heap into the memory budget, while |
1402 // keeping alignment constraints of the heap. To guarantee the latter, as the | |
1403 // NULL page is located before the heap, we pad the NULL page to the conservative | |
1404 // maximum alignment that the GC may ever impose upon the heap. | |
1405 size_t displacement_due_to_null_page = align_size_up_(os::vm_page_size(), | |
1406 Arguments::conservative_max_heap_alignment()); | |
1407 | |
1408 LP64_ONLY(return OopEncodingHeapMax - displacement_due_to_null_page); | |
1398 NOT_LP64(ShouldNotReachHere(); return 0); | 1409 NOT_LP64(ShouldNotReachHere(); return 0); |
1399 } | 1410 } |
1400 | 1411 |
1401 bool Arguments::should_auto_select_low_pause_collector() { | 1412 bool Arguments::should_auto_select_low_pause_collector() { |
1402 if (UseAutoGCSelectPolicy && | 1413 if (UseAutoGCSelectPolicy && |
1437 #endif // _WIN64 | 1448 #endif // _WIN64 |
1438 } else { | 1449 } else { |
1439 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { | 1450 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) { |
1440 warning("Max heap size too large for Compressed Oops"); | 1451 warning("Max heap size too large for Compressed Oops"); |
1441 FLAG_SET_DEFAULT(UseCompressedOops, false); | 1452 FLAG_SET_DEFAULT(UseCompressedOops, false); |
1442 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1453 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1443 } | 1454 } |
1444 } | 1455 } |
1445 #endif // _LP64 | 1456 #endif // _LP64 |
1446 #endif // ZERO | 1457 #endif // ZERO |
1447 } | 1458 } |
1450 // NOTE: set_use_compressed_klass_ptrs() must be called after calling | 1461 // NOTE: set_use_compressed_klass_ptrs() must be called after calling |
1451 // set_use_compressed_oops(). | 1462 // set_use_compressed_oops(). |
1452 void Arguments::set_use_compressed_klass_ptrs() { | 1463 void Arguments::set_use_compressed_klass_ptrs() { |
1453 #ifndef ZERO | 1464 #ifndef ZERO |
1454 #ifdef _LP64 | 1465 #ifdef _LP64 |
1455 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. | 1466 // UseCompressedOops must be on for UseCompressedClassPointers to be on. |
1456 if (!UseCompressedOops) { | 1467 if (!UseCompressedOops) { |
1457 if (UseCompressedKlassPointers) { | 1468 if (UseCompressedClassPointers) { |
1458 warning("UseCompressedKlassPointers requires UseCompressedOops"); | 1469 warning("UseCompressedClassPointers requires UseCompressedOops"); |
1459 } | 1470 } |
1460 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1471 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1461 } else { | 1472 } else { |
1462 // Turn on UseCompressedKlassPointers too | 1473 // Turn on UseCompressedClassPointers too |
1463 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { | 1474 if (FLAG_IS_DEFAULT(UseCompressedClassPointers)) { |
1464 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); | 1475 FLAG_SET_ERGO(bool, UseCompressedClassPointers, true); |
1465 } | 1476 } |
1466 // Check the ClassMetaspaceSize to make sure we use compressed klass ptrs. | 1477 // Check the CompressedClassSpaceSize to make sure we use compressed klass ptrs. |
1467 if (UseCompressedKlassPointers) { | 1478 if (UseCompressedClassPointers) { |
1468 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) { | 1479 if (CompressedClassSpaceSize > KlassEncodingMetaspaceMax) { |
1469 warning("Class metaspace size is too large for UseCompressedKlassPointers"); | 1480 warning("CompressedClassSpaceSize is too large for UseCompressedClassPointers"); |
1470 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false); | 1481 FLAG_SET_DEFAULT(UseCompressedClassPointers, false); |
1471 } | 1482 } |
1472 } | 1483 } |
1473 } | 1484 } |
1474 #endif // _LP64 | 1485 #endif // _LP64 |
1475 #endif // !ZERO | 1486 #endif // !ZERO |
1487 } | |
1488 | |
1489 void Arguments::set_conservative_max_heap_alignment() { | |
1490 // The conservative maximum required alignment for the heap is the maximum of | |
1491 // the alignments imposed by several sources: any requirements from the heap | |
1492 // itself, the collector policy and the maximum page size we may run the VM | |
1493 // with. | |
1494 size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment(); | |
1495 #if INCLUDE_ALL_GCS | |
1496 if (UseParallelGC) { | |
1497 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment(); | |
1498 } else if (UseG1GC) { | |
1499 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment(); | |
1500 } | |
1501 #endif // INCLUDE_ALL_GCS | |
1502 _conservative_max_heap_alignment = MAX3(heap_alignment, os::max_page_size(), | |
1503 CollectorPolicy::compute_max_alignment()); | |
1476 } | 1504 } |
1477 | 1505 |
1478 void Arguments::set_ergonomics_flags() { | 1506 void Arguments::set_ergonomics_flags() { |
1479 | 1507 |
1480 if (os::is_server_class_machine()) { | 1508 if (os::is_server_class_machine()) { |
1500 if (!DumpSharedSpaces && !RequireSharedSpaces && | 1528 if (!DumpSharedSpaces && !RequireSharedSpaces && |
1501 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { | 1529 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) { |
1502 no_shared_spaces(); | 1530 no_shared_spaces(); |
1503 } | 1531 } |
1504 } | 1532 } |
1533 | |
1534 set_conservative_max_heap_alignment(); | |
1505 | 1535 |
1506 #ifndef ZERO | 1536 #ifndef ZERO |
1507 #ifdef _LP64 | 1537 #ifdef _LP64 |
1508 set_use_compressed_oops(); | 1538 set_use_compressed_oops(); |
1509 | 1539 |
2191 status = status && verify_interval(TLABWasteTargetPercent, | 2221 status = status && verify_interval(TLABWasteTargetPercent, |
2192 1, 100, "TLABWasteTargetPercent"); | 2222 1, 100, "TLABWasteTargetPercent"); |
2193 | 2223 |
2194 status = status && verify_object_alignment(); | 2224 status = status && verify_object_alignment(); |
2195 | 2225 |
2196 status = status && verify_interval(ClassMetaspaceSize, 1*M, 3*G, | 2226 status = status && verify_interval(CompressedClassSpaceSize, 1*M, 3*G, |
2197 "ClassMetaspaceSize"); | 2227 "CompressedClassSpaceSize"); |
2198 | 2228 |
2199 status = status && verify_interval(MarkStackSizeMax, | 2229 status = status && verify_interval(MarkStackSizeMax, |
2200 1, (max_jint - 1), "MarkStackSizeMax"); | 2230 1, (max_jint - 1), "MarkStackSizeMax"); |
2201 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); | 2231 status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight"); |
2202 | 2232 |
3324 if (RequireSharedSpaces) { | 3354 if (RequireSharedSpaces) { |
3325 warning("cannot dump shared archive while using shared archive"); | 3355 warning("cannot dump shared archive while using shared archive"); |
3326 } | 3356 } |
3327 UseSharedSpaces = false; | 3357 UseSharedSpaces = false; |
3328 #ifdef _LP64 | 3358 #ifdef _LP64 |
3329 if (!UseCompressedOops || !UseCompressedKlassPointers) { | 3359 if (!UseCompressedOops || !UseCompressedClassPointers) { |
3330 vm_exit_during_initialization( | 3360 vm_exit_during_initialization( |
3331 "Cannot dump shared archive when UseCompressedOops or UseCompressedKlassPointers is off.", NULL); | 3361 "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off.", NULL); |
3332 } | 3362 } |
3333 } else { | 3363 } else { |
3334 // UseCompressedOops and UseCompressedKlassPointers must be on for UseSharedSpaces. | 3364 // UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces. |
3335 if (!UseCompressedOops || !UseCompressedKlassPointers) { | 3365 if (!UseCompressedOops || !UseCompressedClassPointers) { |
3336 no_shared_spaces(); | 3366 no_shared_spaces(); |
3337 } | 3367 } |
3338 #endif | 3368 #endif |
3339 } | 3369 } |
3340 } | 3370 } |
3556 FLAG_SET_DEFAULT(PrintSharedSpaces, false); | 3586 FLAG_SET_DEFAULT(PrintSharedSpaces, false); |
3557 } | 3587 } |
3558 no_shared_spaces(); | 3588 no_shared_spaces(); |
3559 #endif // INCLUDE_CDS | 3589 #endif // INCLUDE_CDS |
3560 | 3590 |
3591 return JNI_OK; | |
3592 } | |
3593 | |
3594 jint Arguments::apply_ergo() { | |
3595 | |
3561 // Set flags based on ergonomics. | 3596 // Set flags based on ergonomics. |
3562 set_ergonomics_flags(); | 3597 set_ergonomics_flags(); |
3563 | 3598 |
3564 set_shared_spaces_flags(); | 3599 set_shared_spaces_flags(); |
3565 | 3600 |
3631 #ifdef CC_INTERP | 3666 #ifdef CC_INTERP |
3632 // Clear flags not supported by the C++ interpreter | 3667 // Clear flags not supported by the C++ interpreter |
3633 FLAG_SET_DEFAULT(ProfileInterpreter, false); | 3668 FLAG_SET_DEFAULT(ProfileInterpreter, false); |
3634 FLAG_SET_DEFAULT(UseBiasedLocking, false); | 3669 FLAG_SET_DEFAULT(UseBiasedLocking, false); |
3635 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); | 3670 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedOops, false)); |
3636 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedKlassPointers, false)); | 3671 LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); |
3637 #endif // CC_INTERP | 3672 #endif // CC_INTERP |
3638 | 3673 |
3639 #ifdef COMPILER2 | 3674 #ifdef COMPILER2 |
3640 if (!UseBiasedLocking || EmitSync != 0) { | 3675 if (!UseBiasedLocking || EmitSync != 0) { |
3641 UseOptoBiasInlining = false; | 3676 UseOptoBiasInlining = false; |
3658 #endif | 3693 #endif |
3659 | 3694 |
3660 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { | 3695 if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
3661 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); | 3696 warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); |
3662 DebugNonSafepoints = true; | 3697 DebugNonSafepoints = true; |
3698 } | |
3699 | |
3700 if (FLAG_IS_CMDLINE(CompressedClassSpaceSize) && !UseCompressedClassPointers) { | |
3701 warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); | |
3663 } | 3702 } |
3664 | 3703 |
3665 #ifndef PRODUCT | 3704 #ifndef PRODUCT |
3666 if (CompileTheWorld) { | 3705 if (CompileTheWorld) { |
3667 // Force NmethodSweeper to sweep whole CodeCache each time. | 3706 // Force NmethodSweeper to sweep whole CodeCache each time. |