hotspot/src/share/vm/runtime/arguments.cpp
changeset 19986 33d188c66ed9
parent 19979 ebe1dbb6e1aa
child 20005 6fb8070af25d
equal deleted inserted replaced
19983:82c1a95ae314 19986:33d188c66ed9
    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 &&
  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 
  3504     FLAG_SET_DEFAULT(PrintSharedSpaces, false);
  3534     FLAG_SET_DEFAULT(PrintSharedSpaces, false);
  3505   }
  3535   }
  3506   no_shared_spaces();
  3536   no_shared_spaces();
  3507 #endif // INCLUDE_CDS
  3537 #endif // INCLUDE_CDS
  3508 
  3538 
       
  3539   return JNI_OK;
       
  3540 }
       
  3541 
       
  3542 jint Arguments::apply_ergo() {
       
  3543 
  3509   // Set flags based on ergonomics.
  3544   // Set flags based on ergonomics.
  3510   set_ergonomics_flags();
  3545   set_ergonomics_flags();
  3511 
  3546 
  3512   set_shared_spaces_flags();
  3547   set_shared_spaces_flags();
  3513 
  3548